From 0d8f6cc82e3e5f5692cca3fcc4b18a9904e601a6 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 9 Jan 2015 21:46:30 +0100 Subject: [PATCH] catch socket.error (e.g. "connection refused"), fixes #195 --- nsupdate/main/dnstools.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nsupdate/main/dnstools.py b/nsupdate/main/dnstools.py index 9cf0cb9..76b73e8 100644 --- a/nsupdate/main/dnstools.py +++ b/nsupdate/main/dnstools.py @@ -325,6 +325,10 @@ def update_ns(fqdn, rdtype='A', ipaddr=None, action='upd', ttl=60): rcode_text, action, name, origin, rdtype, ipaddr)) raise DnsUpdateError(rcode_text) return response + except socket.error as e: + logger.error("socket.error [%s] - zone: %s" % (str(e), origin, )) + set_ns_availability(domain, False) + raise DnsUpdateError("SocketError %d" % e.errno) except dns.exception.Timeout: logger.warning("timeout when performing %s for name %s and origin %s with rdtype %s and ipaddr %s" % ( action, name, origin, rdtype, ipaddr))