installing pip and dnf pieces in sfa_start is too late
[tests.git] / system / TestPlc.py
index 64d552d..d79dc99 100644 (file)
@@ -752,8 +752,8 @@ class TestPlc:
 
         pkgs_list = []
         pkgs_list.append("myplc")
-        pkgs_list.append("slicerepo-{}".format(nodefamily))
-        pkgs_list.append("noderepo-{}".format(nodefamily))
+        pkgs_list.append("slicerepo-{}".format(nodefamily))
+        pkgs_list.append("noderepo-{}".format(nodefamily))
         pkgs_string=" ".join(pkgs_list)
         return self.dnf_install(pkgs_list)
 
@@ -1521,9 +1521,25 @@ class TestPlc:
 
     def sfa_install_all(self):
         "yum install sfa sfa-plc sfa-sfatables sfa-client"
-        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)
+
+        # python2- rpm/dnf packages ar getting deprecated
+        dnf_dependencies = [
+            "m2crypto"
+        ]
+        pip_dependencies = [
+            'sqlalchemy-migrate',
+            'lxml',
+            'python-dateutil',
+            'psycopg2-binary',
+        ]
+        dnf_deps = all((self.run_in_guest(f"dnf -y install {dep}") == 0)
+                   for dep in dnf_dependencies)
+        pip_deps = all((self.run_in_guest(f"pip2 install {dep}") == 0)
+                   for dep in pip_dependencies)
+        return (dnf_deps and pip_deps
+                and 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"
@@ -1711,9 +1727,9 @@ class TestPlc:
         return self.run_in_guest('sfaadmin reg import_registry') == 0
 
     def sfa_start(self):
-        "start SFA through systemctl"
-        return ((self.run_in_guest("pip2 install sqlalchemy-migrate") == 0)
-            and self.start_stop_systemd('sfa-registry', 'start')
+        "start SFA through systemctl - also install dependencies"
+
+        return (self.start_stop_systemd('sfa-registry', 'start')
             and self.start_stop_systemd('sfa-aggregate', 'start'))