From: Noel Power Date: Thu, 26 Apr 2018 17:22:21 +0000 (+0100) Subject: python/samba/netcmd: changes for samab.tests.samba_tool.computer X-Git-Tag: tdb-1.3.17~1921 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=683d51fb5cd7c859cff718d671832247b0a8b3a4;p=thirdparty%2Fsamba.git python/samba/netcmd: changes for samab.tests.samba_tool.computer Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/computer.py b/python/samba/netcmd/computer.py index 16e4bf8b5e6..ff4c3979e78 100644 --- a/python/samba/netcmd/computer.py +++ b/python/samba/netcmd/computer.py @@ -376,7 +376,7 @@ sudo is used so a computer may run the command as root. computer_dn = res[0].dn computer_ac = int(res[0]["userAccountControl"][0]) if "dNSHostName" in res[0]: - computer_dns_host_name = res[0]["dNSHostName"][0] + computer_dns_host_name = str(res[0]["dNSHostName"][0]) else: computer_dns_host_name = None except IndexError: diff --git a/python/samba/remove_dc.py b/python/samba/remove_dc.py index 3dc93741a45..fd14a596029 100644 --- a/python/samba/remove_dc.py +++ b/python/samba/remove_dc.py @@ -137,7 +137,7 @@ def remove_dns_references(samdb, logger, dnsHostName, ignore_no_name=False): # By using a set here, duplicates via (eg) example.com/Configuration # do not matter, they become just example.com a_names_to_remove_from \ - = set(dns_name_from_dn(dn) for dn in ncs) + = set(dns_name_from_dn(str(dn)) for dn in ncs) def a_rec_to_remove(dnsRecord): if dnsRecord.wType == DNS_TYPE_A or dnsRecord.wType == DNS_TYPE_AAAA: diff --git a/python/samba/samdb.py b/python/samba/samdb.py index 53f9c4038fa..fa3e4b1b334 100644 --- a/python/samba/samdb.py +++ b/python/samba/samdb.py @@ -743,7 +743,7 @@ accountExpires: %u def host_dns_name(self): """return the DNS name of this host""" res = self.search(base='', scope=ldb.SCOPE_BASE, attrs=['dNSHostName']) - return res[0]['dNSHostName'][0] + return str(res[0]['dNSHostName'][0]) def domain_dns_name(self): """return the DNS name of the domain root""" diff --git a/python/samba/tests/samba_tool/computer.py b/python/samba/tests/samba_tool/computer.py index 6a19926f368..8c5f332d461 100644 --- a/python/samba/tests/samba_tool/computer.py +++ b/python/samba/tests/samba_tool/computer.py @@ -186,7 +186,7 @@ class ComputerCmdTestCase(SambaToolCmdTest): for computerobj in computerlist: name = computerobj.get("samaccountname", idx=0) - found = self.assertMatch(out, name, + found = self.assertMatch(out, str(name), "computer '%s' not found" % name) def test_move(self): @@ -324,5 +324,5 @@ class ComputerCmdTestCase(SambaToolCmdTest): names = set() for computer in computer_list: for name in computer.get('servicePrincipalName', []): - names.add(name) + names.add(str(name)) return names == set(expected_service_principal_names)