diff --git a/nsupdate/main/models.py b/nsupdate/main/models.py index a9492c7..6adc8d7 100644 --- a/nsupdate/main/models.py +++ b/nsupdate/main/models.py @@ -6,6 +6,7 @@ from django.conf import settings from django.db.models.signals import post_delete from django.contrib.auth.hashers import make_password from main import dnstools +import dns.resolver import re @@ -79,10 +80,16 @@ class Host(models.Model): subdomain=splitted[0], domain__domain=splitted[1], **kwargs) def getIPv4(self): - return dnstools.query(self.get_fqdn(), 'A') + try: + return dnstools.query_ns(self.get_fqdn(), 'A') + except dns.resolver.NXDOMAIN: + return '' def getIPv6(self): - return dnstools.query(self.get_fqdn(), 'AAAA') + try: + return dnstools.query_ns(self.get_fqdn(), 'A') + except dns.resolver.NXDOMAIN: + return '' def generate_secret(self): # note: we use a quick hasher for the update_secret as expensive diff --git a/nsupdate/main/templates/main/overview.html b/nsupdate/main/templates/main/overview.html index 8351f02..8deccbb 100644 --- a/nsupdate/main/templates/main/overview.html +++ b/nsupdate/main/templates/main/overview.html @@ -3,7 +3,7 @@ {% block content %}
-
+

Host List

@@ -24,7 +24,7 @@ {% endfor %}
domainlast updateIPv4IPv6commentaction
-
+

New Host

{% csrf_token %}