python/samba/netcmd: changes for samab.tests.samba_tool.computer
authorNoel Power <noel.power@suse.com>
Thu, 26 Apr 2018 17:22:21 +0000 (18:22 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 3 Sep 2018 01:22:23 +0000 (03:22 +0200)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/computer.py
python/samba/remove_dc.py
python/samba/samdb.py
python/samba/tests/samba_tool/computer.py

index 16e4bf8b5e6f064c9f2384026c6f54f32f303c4f..ff4c3979e78db3da84f07f27b350b0b41bc26f34 100644 (file)
@@ -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:
index 3dc93741a45d0d29d9d26605ba7ae901a358d735..fd14a596029091753f3df83a3383e9a15b2f1b1e 100644 (file)
@@ -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:
index 53f9c4038faf804f6308d58c4306acf230ba0eac..fa3e4b1b33405a41849fcf766bdcae389b8885de 100644 (file)
@@ -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"""
index 6a19926f3682c4b6699d642e6ab2b87a68043229..8c5f332d46150f59fb015e044b116a981c1333e0 100644 (file)
@@ -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)