try to work around the broken gethostbyaddr more thoroughly
[tests.git] / system / TestPlc.py
index c50b952..57543d1 100644 (file)
@@ -24,6 +24,8 @@ from PlcapiUrlScanner import PlcapiUrlScanner
 
 from TestBonding import TestBonding
 
+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)
@@ -245,7 +247,7 @@ class TestPlc:
         # warning, we're now building 'sface' so let's be a bit more picky
         # full builds are expected to return with 0 here
         utils.header("Checking if build provides SFA package...")
-        retcod = utils.system("curl --silent {}/ | grep -q sfa-".format(rpms_url)) == 0
+        retcod = utils.system("curl --silent {}/ | grep -q sfa-4".format(rpms_url)) == 0
         encoded = 'yes' if retcod else 'no'
         with open(has_sfa_cache_filename,'w') as cache:
             cache.write(encoded)
@@ -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