define PLC_MAIL_FROM_ADDRESS
[tests.git] / system / TestPlc.py
index 633fde2..9cf5a2f 100644 (file)
@@ -24,7 +24,9 @@ from PlcapiUrlScanner import PlcapiUrlScanner
 
 from TestBonding import TestBonding
 
-has_sfa_cache_filename="sfa-cache"
+from gethostbyaddr import workaround_gethostbyaddr
+
+has_sfa_cache_filename = "sfa-cache"
 
 # step methods must take (self) and return a boolean (options is a member of the class)
 
@@ -712,13 +714,12 @@ class TestPlc:
         script_options += " -f {}".format(self.options.fcdistro)
         script_options += " -r {}".format(repo_url)
         vserver_name = self.vservername
-        try:
-            vserver_hostname = socket.gethostbyaddr(self.vserverip)[0]
-            script_options += " -n {}".format(vserver_hostname)
-        except:
+        vserver_hostname = workaround_gethostbyaddr(self.vserverip)
+        if not vserver_hostname:
             print("Cannot reverse lookup {}".format(self.vserverip))
             print("This is considered fatal, as this might pollute the test results")
             return False
+        script_options += " -n {}".format(vserver_hostname)
         create_vserver="{build_dir}/{script} {script_options} {vserver_name}".format(**locals())
         return self.run_in_host(create_vserver) == 0