get_ip: if there is no A/AAAA record, anwer "none" (anwer "error" only in real error cases)

This commit is contained in:
Thomas Waldmann 2014-01-22 14:03:36 +01:00
parent c0cb56a97d
commit 400259c758

View File

@ -202,8 +202,9 @@ class Host(models.Model):
record = 'A' if kind == 'ipv4' else 'AAAA'
try:
return dnstools.query_ns(self.get_fqdn(), record, origin=self.domain.domain)
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer, dns.resolver.NoNameservers, dns.resolver.Timeout,
dnstools.NameServerNotAvailable):
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
return 'none'
except (dns.resolver.NoNameservers, dns.resolver.Timeout, dnstools.NameServerNotAvailable):
return 'error'
def get_ipv4(self):