Update deprecated function from dnspython
This commit is contained in:
parent
60911515fd
commit
5e597bb536
|
@ -940,9 +940,9 @@ def get_secondary_dns(custom_dns, mode=None):
|
|||
# doesn't.
|
||||
if not hostname.startswith("xfr:"):
|
||||
if mode == "xfr":
|
||||
response = dns.resolver.query(hostname+'.', "A", raise_on_no_answer=False)
|
||||
response = dns.resolver.resolve(hostname+'.', "A", raise_on_no_answer=False)
|
||||
values.extend(map(str, response))
|
||||
response = dns.resolver.query(hostname+'.', "AAAA", raise_on_no_answer=False)
|
||||
response = dns.resolver.resolve(hostname+'.', "AAAA", raise_on_no_answer=False)
|
||||
values.extend(map(str, response))
|
||||
continue
|
||||
values.append(hostname)
|
||||
|
@ -965,9 +965,9 @@ def set_secondary_dns(hostnames, env):
|
|||
if not item.startswith("xfr:"):
|
||||
# Resolve hostname.
|
||||
try:
|
||||
response = resolver.query(item, "A")
|
||||
response = resolver.resolve(item, "A")
|
||||
except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
||||
response = resolver.query(item, "AAAA")
|
||||
response = resolver.resolve(item, "AAAA")
|
||||
except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
||||
raise ValueError("Could not resolve the IP address of %s." % item)
|
||||
else:
|
||||
|
|
|
@ -744,7 +744,7 @@ def query_dns(qname, rtype, nxdomain='[Not Set]', at=None):
|
|||
|
||||
# Do the query.
|
||||
try:
|
||||
response = resolver.query(qname, rtype)
|
||||
response = resolver.resolve(qname, rtype)
|
||||
except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
||||
# Host did not have an answer for this query; not sure what the
|
||||
# difference is between the two exceptions.
|
||||
|
|
Loading…
Reference in New Issue