Validating that DNS can resolve hostname to IP in LinuxNode
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Thu, 30 Oct 2014 16:07:12 +0000 (17:07 +0100)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Thu, 30 Oct 2014 16:07:12 +0000 (17:07 +0100)
src/nepi/resources/linux/node.py

index 232a9df..7873b97 100644 (file)
@@ -367,10 +367,14 @@ class LinuxNode(ResourceManager):
 
         self.mkdir(paths)
 
-        # Get Public IP address
+        # Get Public IP address if possible
         if not self.get("ip"):
             if self.localhost:
-                ip = socket.gethostbyname(socket.gethostname())
+                try:
+                   ip = socket.gethostbyname(socket.gethostname())
+                except:
+                    msg = "DNS can not resolve hostname %s" % self.get("hostname") 
+                    self.debug(msg)
             else:
                 ip = socket.gethostbyname(self.get("hostname"))