re.compile arguments made raw-strings for py-3.13
[tests.git] / system / TestPlc.py
index 633fde2..e7b41f6 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
 
@@ -1618,7 +1619,7 @@ class TestPlc:
             return True
         utils.header("********** Regular yum failed - special workaround in place, 2nd chance")
         code, cached_rpm_path = \
-                utils.output_of(self.actual_command_in_guest('find /var/cache/yum -name sfa-client\*.rpm'))
+                utils.output_of(self.actual_command_in_guest(r'find /var/cache/yum -name sfa-client\*.rpm'))
         utils.header("rpm_path=<<{}>>".format(rpm_path))
         # just for checking
         self.run_in_guest("rpm -i {}".format(cached_rpm_path))