From 5e597bb5362362083fd7309149bccaecec913475 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 26 Jul 2020 01:00:17 +0100 Subject: [PATCH] Update deprecated function from dnspython --- management/dns_update.py | 8 ++++---- management/status_checks.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/management/dns_update.py b/management/dns_update.py index 4a223b66..21ebc53c 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -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: diff --git a/management/status_checks.py b/management/status_checks.py index a44832fd..6e0cdb44 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -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.