From 335a0c5046e0799f241d8a8904cdfd93188e7be1 Mon Sep 17 00:00:00 2001 From: parmentelat Date: Mon, 10 Dec 2018 15:53:17 +0100 Subject: [PATCH] tweaks around installations; in particular, check for install of myplc-core --- system/TestPlc.py | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/system/TestPlc.py b/system/TestPlc.py index b6f7e0e..9dd64ec 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -48,7 +48,7 @@ def node_mapper(method): node_method = TestNode.__dict__[method.__name__] for test_node in self.all_nodes(): if not node_method(test_node, *args, **kwds): - overall=False + overall = False return overall # maintain __name__ for ignore_result map_on_nodes.__name__ = method.__name__ @@ -334,21 +334,22 @@ class TestPlc: return utils.system(local+" | "+self.test_ssh.actual_command(self.host_to_guest(remote), keep_stdin = True)) - def yum_check_installed(self, rpms): + def dnf_check_installed(self, rpms): if isinstance(rpms, list): rpms=" ".join(rpms) return self.run_in_guest("rpm -q {}".format(rpms)) == 0 # does a yum install in the vs, ignore yum retcod, check with rpm - def yum_install(self, rpms): + def dnf_install(self, rpms): if isinstance(rpms, list): rpms=" ".join(rpms) - yum_mode = self.run_in_guest("yum -y install {}".format(rpms)) + yum_mode = self.run_in_guest("dnf -y install {}".format(rpms)) if yum_mode != 0: self.run_in_guest("dnf -y install --allowerasing {}".format(rpms)) # yum-complete-transaction comes with yum-utils, that is in vtest.pkgs - self.run_in_guest("yum-complete-transaction -y") - return self.yum_check_installed(rpms) + # nothing similar with dnf, forget about this for now + # self.run_in_guest("yum-complete-transaction -y") + return self.dnf_check_installed(rpms) def pip_install(self, package): return self.run_in_guest("pip -y install {}".format(package)) == 0 @@ -738,12 +739,16 @@ class TestPlc: raise Exception("Unsupported personality {}".format(self.options.personality)) nodefamily = "{}-{}-{}".format(self.options.pldistro, self.options.fcdistro, arch) - pkgs_list=[] - pkgs_list.append("slicerepo-{}".format(nodefamily)) + # check it's possible to install just 'myplc-core' first + if not self.dnf_install("myplc-core"): + return False + + pkgs_list = [] pkgs_list.append("myplc") + pkgs_list.append("slicerepo-{}".format(nodefamily)) pkgs_list.append("noderepo-{}".format(nodefamily)) pkgs_string=" ".join(pkgs_list) - return self.yum_install(pkgs_list) + return self.dnf_install(pkgs_list) def install_syslinux6(self): """ @@ -781,7 +786,7 @@ class TestPlc: ### def mod_python(self): """yum install mod_python, useful on f18 and above so as to avoid broken wsgi""" - return self.yum_install( ['mod_python'] ) + return self.dnf_install( ['mod_python'] ) ### def plc_configure(self): @@ -1509,21 +1514,21 @@ class TestPlc: def sfa_install_all(self): "yum install sfa sfa-plc sfa-sfatables sfa-client" - return (self.yum_install("sfa sfa-plc sfa-sfatables sfa-client") and + return (self.dnf_install("sfa sfa-plc sfa-sfatables sfa-client") and self.run_in_guest("systemctl enable sfa-registry")==0 and self.run_in_guest("systemctl enable sfa-aggregate")==0) def sfa_install_core(self): "yum install sfa" - return self.yum_install("sfa") + return self.dnf_install("sfa") def sfa_install_plc(self): "yum install sfa-plc" - return self.yum_install("sfa-plc") + return self.dnf_install("sfa-plc") def sfa_install_sfatables(self): "yum install sfa-sfatables" - return self.yum_install("sfa-sfatables") + return self.dnf_install("sfa-sfatables") # for some very odd reason, this sometimes fails with the following symptom # # yum install sfa-client @@ -1546,7 +1551,7 @@ class TestPlc: # so as a workaround, we first try yum install, and then invoke rpm on the cached rpm... def sfa_install_client(self): "yum install sfa-client" - first_try = self.yum_install("sfa-client") + first_try = self.dnf_install("sfa-client") if first_try: return True utils.header("********** Regular yum failed - special workaround in place, 2nd chance") @@ -1555,7 +1560,7 @@ class TestPlc: utils.header("rpm_path=<<{}>>".format(rpm_path)) # just for checking self.run_in_guest("rpm -i {}".format(cached_rpm_path)) - return self.yum_check_installed("sfa-client") + return self.dnf_check_installed("sfa-client") def sfa_dbclean(self): "thoroughly wipes off the SFA database" @@ -1615,8 +1620,8 @@ class TestPlc: # if the yum install phase fails, consider the test is successful # other combinations will eventually run it hopefully def sfa_utest(self): - "yum install sfa-tests and run SFA unittests" - self.run_in_guest("yum -y install sfa-tests") + "dnf install sfa-tests and run SFA unittests" + self.run_in_guest("dnf -y install sfa-tests") # failed to install - forget it if self.run_in_guest("rpm -q sfa-tests") != 0: utils.header("WARNING: SFA unit tests failed to install, ignoring") -- 2.43.0