# 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:
# 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"
computer_dn = None
try:
- dnsHostName = msgs[0]["dnsHostName"][0]
+ dnsHostName = str(msgs[0]["dnsHostName"][0])
except KeyError:
dnsHostName = None
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))" %