resolve(): Handle non-existing DNS records.
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 10 Jun 2014 21:58:25 +0000 (23:58 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 10 Jun 2014 21:58:25 +0000 (23:58 +0200)
src/ddns/system.py

index a071e48..90226b3 100644 (file)
@@ -194,7 +194,14 @@ class DDNSSystem(object):
                        raise ValueError("Protocol not supported: %s" % proto)
 
                # Resolve the host address.
-               response = socket.getaddrinfo(hostname, None, family)
+               try:
+                       response = socket.getaddrinfo(hostname, None, family)
+               except socket.gaierror, e:
+                       # Name or service not known
+                       if e.errno == -2:
+                               return []
+
+                       raise
 
                # Handle responses.
                for family, socktype, proto, canonname, sockaddr in response: