X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2FTestPlc.py;h=9cf5a2fafb9875be91c21ae8bf864a1b04e7cea6;hb=4612768c957af0080bbf4de90d93d3559f300a27;hp=8c046a000d888454ae40bdf3173a422d7bcd5dbc;hpb=509fd374495c1ce3ae7eb4fdf57538f42f673cc2;p=tests.git diff --git a/system/TestPlc.py b/system/TestPlc.py index 8c046a0..9cf5a2f 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -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) @@ -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) @@ -359,7 +361,7 @@ class TestPlc: return self.dnf_check_installed(rpms) def pip3_install(self, package): - return self.run_in_guest("pip3 install {}".format(package)) == 0 + return self.run_in_guest(f"pip3 install {package} || pip install {package}") == 0 def auth_root(self): return {'Username' : self.plc_spec['settings']['PLC_ROOT_USER'], @@ -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 @@ -1522,7 +1523,7 @@ class TestPlc: def install_pip2(self): replacements = [ - "https://acc.dl.osdn.jp/storage/g/u/un/unitedrpms/32/x86_64/python2-pip-19.1.1-7.fc32.noarch.rpm", + "http://mirror.onelab.eu/third-party/python2-pip-19.1.1-7.fc33.noarch.rpm", ] return ( @@ -1540,8 +1541,9 @@ class TestPlc: # an install from sources and that's quite awkward replacements = [ - "http://mirror.onelab.eu/fedora/releases/31/Everything/x86_64/os/Packages/p/python2-typing-3.6.2-5.fc31.noarch.rpm", - "http://mirror.onelab.eu/fedora/releases/31/Everything/x86_64/os/Packages/p/python2-m2crypto-0.35.2-2.fc31.x86_64.rpm", + # no longer on our mirror + "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Everything/x86_64/os/Packages/p/python2-typing-3.6.2-5.fc31.noarch.rpm", + "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Everything/x86_64/os/Packages/p/python2-m2crypto-0.35.2-2.fc31.x86_64.rpm", ] return ( @@ -1549,12 +1551,7 @@ class TestPlc: or self.run_in_guest("pip2 install python2-m2crypto") == 0 or self.run_in_guest("dnf localinstall -y " + " ".join(replacements)) == 0) - return attempt - - # about pip2: - # we can try and use - # that qould then need to be mirrored - # so the logic goes like this + # about pip2: the logic goes like this # check for pip2 command # if not, try dnf install python2-pip # if still not, dnf localinstall the above @@ -1572,6 +1569,7 @@ class TestPlc: 'lxml', 'python-dateutil', 'psycopg2-binary', + 'pyOpenSSL', ] return (