Merge pull request #343 from ThomasWaldmann/fix-335
work around UnknownTSIGKey exception blowing up the overview view
This commit is contained in:
commit
ba43006194
@ -28,6 +28,7 @@ import random
|
|||||||
import struct
|
import struct
|
||||||
|
|
||||||
import dns.inet
|
import dns.inet
|
||||||
|
import dns.message
|
||||||
import dns.name
|
import dns.name
|
||||||
import dns.resolver
|
import dns.resolver
|
||||||
import dns.query
|
import dns.query
|
||||||
@ -256,7 +257,7 @@ def query_ns(fqdn, rdtype, prefer_primary=False):
|
|||||||
ip = str(list(answer)[0])
|
ip = str(list(answer)[0])
|
||||||
logger.debug("query: %s answer: %s" % (fqdn, ip))
|
logger.debug("query: %s answer: %s" % (fqdn, ip))
|
||||||
return ip
|
return ip
|
||||||
except (dns.resolver.Timeout, dns.resolver.NoNameservers) as e: # socket.error also?
|
except (dns.resolver.Timeout, dns.resolver.NoNameservers, dns.message.UnknownTSIGKey) as e: # socket.error also?
|
||||||
logger.warning("error when querying for name '%s' in zone '%s' with rdtype '%s' [%s]." % (
|
logger.warning("error when querying for name '%s' in zone '%s' with rdtype '%s' [%s]." % (
|
||||||
fqdn.host, origin, rdtype, str(e)))
|
fqdn.host, origin, rdtype, str(e)))
|
||||||
set_ns_availability(origin, False)
|
set_ns_availability(origin, False)
|
||||||
|
@ -7,6 +7,7 @@ import time
|
|||||||
import base64
|
import base64
|
||||||
|
|
||||||
import dns.resolver
|
import dns.resolver
|
||||||
|
import dns.message
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
@ -288,7 +289,8 @@ class Host(models.Model):
|
|||||||
return dnstools.query_ns(self.get_fqdn(), record)
|
return dnstools.query_ns(self.get_fqdn(), record)
|
||||||
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
||||||
return None
|
return None
|
||||||
except (dns.resolver.NoNameservers, dns.resolver.Timeout, dnstools.NameServerNotAvailable):
|
except (dns.resolver.NoNameservers, dns.resolver.Timeout, dnstools.NameServerNotAvailable,
|
||||||
|
dns.message.UnknownTSIGKey):
|
||||||
return _('error')
|
return _('error')
|
||||||
|
|
||||||
def get_ipv4(self):
|
def get_ipv4(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user