catch more query_ns exceptions. try update/delete even if query_ns failed.
it could be maybe the secondary DNS that failed for query_ns, so we can still try talking to the primary.
This commit is contained in:
parent
b0103fe5d1
commit
6261b64b72
@ -148,11 +148,17 @@ def delete(fqdn, rdtype=None):
|
||||
try:
|
||||
# check if we have a DNS entry
|
||||
query_ns(fqdn, rdtype)
|
||||
# there is a dns entry
|
||||
ok = True
|
||||
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
||||
# no dns entry, it is already deleted
|
||||
pass
|
||||
else:
|
||||
# there is a DNS entry, send a del
|
||||
ok = False
|
||||
except (dns.resolver.Timeout, dns.resolver.NoNameservers) as e: # socket.error also?
|
||||
# maybe could be caused by secondary DNS Timeout and master still ok?
|
||||
# assume the delete is OK...
|
||||
ok = True
|
||||
if ok:
|
||||
# send a del
|
||||
update_ns(fqdn, rdtype, action='del')
|
||||
|
||||
|
||||
@ -176,6 +182,10 @@ def update(fqdn, ipaddr, ttl=60):
|
||||
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
||||
# no dns entry yet, ok
|
||||
ok = True
|
||||
except (dns.resolver.Timeout, dns.resolver.NoNameservers) as e: # socket.error also?
|
||||
# maybe could be caused by secondary DNS Timeout and master still ok?
|
||||
# assume the update is OK...
|
||||
ok = True
|
||||
if ok:
|
||||
# only send an update if the ip really changed as the update
|
||||
# causes write I/O on the nameserver and also traffic to the
|
||||
|
Loading…
x
Reference in New Issue
Block a user