]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
if /etc/resolv.conf does not exist, just use the default resolver config
authorBob Halley <halley@dnspython.org>
Thu, 17 Aug 2006 07:03:27 +0000 (07:03 +0000)
committerBob Halley <halley@dnspython.org>
Thu, 17 Aug 2006 07:03:27 +0000 (07:03 +0000)
ChangeLog
dns/resolver.py

index 41486aaf621c302f97ac4268f66ebb1d136db6d4..25512f64e9cfe6467c055a85f4d76b4c7e1face6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-08-17  Bob Halley  <halley@dnspython.org>
+
+       * dns/resolver.py (Resolver.read_resolv_conf): If /etc/resolv.conf
+         doesn't exist, just use the default resolver configuration (i.e.
+         the same thing we would have used if resolv.conf had existed and
+         been empty).
+
 2006-07-26  Bob Halley  <halley@dnspython.org>
 
        * dns/resolver.py (Resolver._config_win32_fromkey): fix
index 289160345e16fa8edee3d08ec09292926abbd935..43719b7194ee02b44859a0c0ad127b2ed718ccb5 100644 (file)
@@ -317,7 +317,13 @@ class Resolver(object):
         a string, it is used as the name of the file to open; otherwise it
         is treated as the file itself."""
         if isinstance(f, str) or isinstance(f, unicode):
-            f = open(f, 'r')
+            try:
+                f = open(f, 'r')
+            except IOError:
+                # /etc/resolv.conf doesn't exist, can't be read, etc.
+                # We'll just use the default resolver configuration.
+                self.nameservers = ['127.0.0.1']
+                return
             want_close = True
         else:
             want_close = False