[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Fix crash on hostname not found



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv9261/lib/mixminion

Modified Files:
	NetUtils.py 
Log Message:
Fix crash on hostname not found

Index: NetUtils.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/NetUtils.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- NetUtils.py	4 Dec 2003 05:02:50 -0000	1.6
+++ NetUtils.py	18 Dec 2003 22:55:27 -0000	1.7
@@ -69,7 +69,7 @@
         inet4 = [ addr for addr in r if addr[0] == AF_INET ]
         inet6 = [ addr for addr in r if addr[0] == AF_INET6 ]
         if not (inet4 or inet6):
-            LOG.error("getIP returned no inet addresses!")
+            LOG.warn("getIP returned no inet addresses for %r",name)
             return ("NOENT", "No inet addresses returned", time.time())
         best4=best6=None
         if inet4: best4=inet4[0]
@@ -79,6 +79,8 @@
         else:
             res = best6 or best4
         assert res
+        assert res[0] in (AF_INET, AF_INET6)
+        assert nameIsStaticIP(res[1])
         protoname = (res[0] == AF_INET) and "inet" or "inet6"
         LOG.trace("Result for getIP(%r): %s:%s (%d others dropped)",
                   name,protoname,res[1],len(r)-1)
@@ -89,6 +91,7 @@
             return ("NOENT", str(e[1]), time.time())
         else:
             return ("NOENT", str(e), time.time())
+
 #----------------------------------------------------------------------
 
 _SOCKETS_SUPPORT_TIMEOUT = hasattr(socket.SocketType, "settimeout")