summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2018-04-17 16:48:03 +0100
committerAndrew Bartlett <abartlet@samba.org>2018-09-03 03:22:21 +0200
commitc6100d777bbd73c9e58adb372972f02d7655ee13 (patch)
tree6ee5c6bca831107bac61f92feb4a5649fa0c4636 /python
parent94c23ee046ca9cfa36ab5aedfeb56faf8eee459c (diff)
downloadsamba-c6100d777bbd73c9e58adb372972f02d7655ee13.tar.gz
python/samba: changes to make samba.tests.samba_tool.join run under py3
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/join.py6
-rw-r--r--python/samba/netcmd/domain_backup.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/python/samba/join.py b/python/samba/join.py
index 9cab604ec4a..e7963eeaa1e 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -354,21 +354,21 @@ class DCJoinContext(object):
def get_dnsHostName(ctx):
res = ctx.samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dnsHostName"])
- return res[0]["dnsHostName"][0]
+ return str(res[0]["dnsHostName"][0])
def get_domain_name(ctx):
'''get netbios name of the domain from the partitions record'''
partitions_dn = ctx.samdb.get_partitions_dn()
res = ctx.samdb.search(base=partitions_dn, scope=ldb.SCOPE_ONELEVEL, attrs=["nETBIOSName"],
expression='ncName=%s' % ldb.binary_encode(str(ctx.samdb.get_default_basedn())))
- return res[0]["nETBIOSName"][0]
+ return str(res[0]["nETBIOSName"][0])
def get_forest_domain_name(ctx):
'''get netbios name of the domain from the partitions record'''
partitions_dn = ctx.samdb.get_partitions_dn()
res = ctx.samdb.search(base=partitions_dn, scope=ldb.SCOPE_ONELEVEL, attrs=["nETBIOSName"],
expression='ncName=%s' % ldb.binary_encode(str(ctx.samdb.get_root_basedn())))
- return res[0]["nETBIOSName"][0]
+ return str(res[0]["nETBIOSName"][0])
def get_parent_partition_dn(ctx):
'''get the parent domain partition DN from parent DNS name'''
diff --git a/python/samba/netcmd/domain_backup.py b/python/samba/netcmd/domain_backup.py
index c2f056e6ba3..de53c6e5113 100644
--- a/python/samba/netcmd/domain_backup.py
+++ b/python/samba/netcmd/domain_backup.py
@@ -891,7 +891,7 @@ class cmd_domain_backup_offline(samba.netcmd.Command):
# If more than one directory is a parent of this path, then at least
# one configured path is a subdir of another. Use closest match.
if len(matching_dirs) > 1:
- arc_path, fs_path = max(matching_dirs, key=lambda (_, p): len(p))
+ arc_path, fs_path = max(matching_dirs, key=lambda p: len(p[1]))
arc_path += path[len(fs_path):]
return arc_path