gpo: avoid quadratic behaviour in guid retrieval
[nivanova/samba-autobuild/.git] / python / samba / remove_dc.py
index 3dc93741a45d0d29d9d26605ba7ae901a358d735..a6062703f24df4df90ca66ab947fa6cdfe13ff92 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:
@@ -198,7 +198,7 @@ def remove_hanging_dns_references(samdb, logger, dnsHostNameUpper, zones):
 
             # Remove references to dnsHostName in A, AAAA, NS, CNAME and SRV
             values = [ndr_unpack(dnsp.DnssrvRpcRecord, v)
-                       for v in orig_values if not to_remove(v)]
+                      for v in orig_values if not to_remove(v)]
 
             if len(values) != len(orig_values):
                 logger.info("updating %s keeping %d values, removing %s values"
@@ -237,7 +237,7 @@ def offline_remove_server(samdb, logger,
         computer_dn = None
 
     try:
-        dnsHostName = msgs[0]["dnsHostName"][0]
+        dnsHostName = str(msgs[0]["dnsHostName"][0])
     except KeyError:
         dnsHostName = None
 
@@ -268,7 +268,7 @@ def offline_remove_server(samdb, logger,
             samdb.delete(computer_dn, ["tree_delete:0"])
 
         if "dnsHostName" in msgs[0]:
-            dnsHostName = msgs[0]["dnsHostName"][0]
+            dnsHostName = str(msgs[0]["dnsHostName"][0])
 
     if remove_dns_account:
         res = samdb.search(expression="(&(objectclass=user)(cn=dns-%s)(servicePrincipalName=DNS/%s))" %