mirror of
https://github.com/samba-team/samba.git
synced 2025-12-21 20:23:50 +03:00
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>
This commit is contained in:
committed by
Andrew Bartlett
parent
94c23ee046
commit
c6100d777b
@@ -354,21 +354,21 @@ class DCJoinContext(object):
|
|||||||
|
|
||||||
def get_dnsHostName(ctx):
|
def get_dnsHostName(ctx):
|
||||||
res = ctx.samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dnsHostName"])
|
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):
|
def get_domain_name(ctx):
|
||||||
'''get netbios name of the domain from the partitions record'''
|
'''get netbios name of the domain from the partitions record'''
|
||||||
partitions_dn = ctx.samdb.get_partitions_dn()
|
partitions_dn = ctx.samdb.get_partitions_dn()
|
||||||
res = ctx.samdb.search(base=partitions_dn, scope=ldb.SCOPE_ONELEVEL, attrs=["nETBIOSName"],
|
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())))
|
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):
|
def get_forest_domain_name(ctx):
|
||||||
'''get netbios name of the domain from the partitions record'''
|
'''get netbios name of the domain from the partitions record'''
|
||||||
partitions_dn = ctx.samdb.get_partitions_dn()
|
partitions_dn = ctx.samdb.get_partitions_dn()
|
||||||
res = ctx.samdb.search(base=partitions_dn, scope=ldb.SCOPE_ONELEVEL, attrs=["nETBIOSName"],
|
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())))
|
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):
|
def get_parent_partition_dn(ctx):
|
||||||
'''get the parent domain partition DN from parent DNS name'''
|
'''get the parent domain partition DN from parent DNS name'''
|
||||||
|
|||||||
@@ -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
|
# 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.
|
# one configured path is a subdir of another. Use closest match.
|
||||||
if len(matching_dirs) > 1:
|
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):]
|
arc_path += path[len(fs_path):]
|
||||||
|
|
||||||
return arc_path
|
return arc_path
|
||||||
|
|||||||
Reference in New Issue
Block a user