fixed uncaptured exceptions NXDOMAIN. increased table size in the overview
This commit is contained in:
parent
0db1697898
commit
a4e3ab4e58
@ -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
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="col-lg-9">
|
||||
<h3>Host List</h3>
|
||||
<table class="table">
|
||||
<tr><th>domain</th><th>last update</th><th>IPv4</th><th>IPv6</th><th>comment</th><th>action</th></tr>
|
||||
@ -24,7 +24,7 @@
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="col-lg-3">
|
||||
<h3>New Host</h3>
|
||||
<form method="post" action="">
|
||||
{% csrf_token %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user