You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2023/01/20 09:56:14 UTC

[cloudstack] 01/01: address review comments

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch el9-mask-fix
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit f62250603e84c156693b11d56ba5bd397f170970
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Fri Jan 20 15:25:49 2023 +0530

    address review comments
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 python/lib/cloudutils/syscfg.py    | 54 ++++++++++++++------------------------
 python/lib/cloudutils/utilities.py |  4 +++
 2 files changed, 24 insertions(+), 34 deletions(-)

diff --git a/python/lib/cloudutils/syscfg.py b/python/lib/cloudutils/syscfg.py
index 99eb4eafa5..19032ce4af 100755
--- a/python/lib/cloudutils/syscfg.py
+++ b/python/lib/cloudutils/syscfg.py
@@ -37,16 +37,14 @@ class sysConfigAgentFactory:
         distribution = glbEnv.distribution.getVersion()
         if distribution == "Ubuntu":
             return sysConfigAgentUbuntu(glbEnv)
-        elif distribution == "Fedora" or distribution == "RHEL6":
-            return sysConfigRedhat6(glbEnv)
         elif distribution == "CentOS" or distribution == "RHEL5":
-            return sysConfigRedhat5(glbEnv)
+            return sysConfigEL5(glbEnv)
+        elif distribution == "Fedora" or distribution == "RHEL6":
+            return sysConfigEL6(glbEnv)
         elif distribution == "RHEL7":
-            return sysConfigRedhat7(glbEnv)
-        elif distribution == "RHEL8":
-            return sysConfigRedhat8(glbEnv)
-        elif distribution == "RHEL9":
-            return sysConfigRedhat9(glbEnv)
+            return sysConfigEL7(glbEnv)
+        elif distribution in ["RHEL8", "RHEL9"]:
+            return sysConfigEL(glbEnv)
         elif distribution == "SUSE":
             return sysConfigSUSE(glbEnv)
         else:
@@ -153,10 +151,10 @@ class sysConfigAgentRedhat7Base(sysConfigAgent):
         self.svo = serviceOpsRedhat7Later()
         super(sysConfigAgentRedhat7Base, self).__init__(env)
 
-class sysConfigAgentRedhat8Base(sysConfigAgent):
+class sysConfigAgentELBase(sysConfigAgent):
     def __init__(self, env):
         self.svo = serviceOpsRedhat7Later()
-        super(sysConfigAgentRedhat8Base, self).__init__(env)
+        super(sysConfigAgentELBase, self).__init__(env)
 
 class sysConfigAgentSUSE(sysConfigAgent):
     def __init__(self, env):
@@ -176,23 +174,10 @@ class sysConfigAgentUbuntu(sysConfigAgent):
                          nfsConfig(self),
                          cloudAgentConfig(self)]
 
-#it covers RHEL6/Fedora13/Fedora14
-class sysConfigRedhat6(sysConfigAgentRedhatBase):
-    def __init__(self, glbEnv):
-        super(sysConfigRedhat6, self).__init__(glbEnv)
-        self.services = [hostConfig(self),
-                         cgroupConfig(self),
-                         securityPolicyConfigRedhat(self),
-                         networkConfigRedhat(self),
-                         libvirtConfigRedhat(self),
-                         firewallConfigAgent(self),
-                         nfsConfig(self),
-                         cloudAgentConfig(self)]
-
 #It covers RHEL5/CentOS5, the mainly difference is that there is no cgroup
-class sysConfigRedhat5(sysConfigAgentRedhatBase):
+class sysConfigEL5(sysConfigAgentRedhatBase):
     def __init__(self, glbEnv):
-        super(sysConfigRedhat5, self).__init__(glbEnv)
+        super(sysConfigEL5, self).__init__(glbEnv)
         self.services = [hostConfig(self),
                          securityPolicyConfigRedhat(self),
                          networkConfigRedhat(self),
@@ -200,11 +185,12 @@ class sysConfigRedhat5(sysConfigAgentRedhatBase):
                          firewallConfigAgent(self),
                          cloudAgentConfig(self)]
 
-#it covers RHEL7
-class sysConfigRedhat7(sysConfigAgentRedhat7Base):
+#it covers RHEL6/Fedora13/Fedora14
+class sysConfigEL6(sysConfigAgentRedhatBase):
     def __init__(self, glbEnv):
-        super(sysConfigRedhat7, self).__init__(glbEnv)
+        super(sysConfigEL6, self).__init__(glbEnv)
         self.services = [hostConfig(self),
+                         cgroupConfig(self),
                          securityPolicyConfigRedhat(self),
                          networkConfigRedhat(self),
                          libvirtConfigRedhat(self),
@@ -212,10 +198,10 @@ class sysConfigRedhat7(sysConfigAgentRedhat7Base):
                          nfsConfig(self),
                          cloudAgentConfig(self)]
 
-#it covers RHEL8
-class sysConfigRedhat8(sysConfigAgentRedhat8Base):
+#it covers RHEL7
+class sysConfigEL7(sysConfigAgentRedhat7Base):
     def __init__(self, glbEnv):
-        super(sysConfigRedhat8, self).__init__(glbEnv)
+        super(sysConfigEL7, self).__init__(glbEnv)
         self.services = [hostConfig(self),
                          securityPolicyConfigRedhat(self),
                          networkConfigRedhat(self),
@@ -224,10 +210,10 @@ class sysConfigRedhat8(sysConfigAgentRedhat8Base):
                          nfsConfig(self),
                          cloudAgentConfig(self)]
 
-#it covers RHEL9
-class sysConfigRedhat9(sysConfigAgentRedhat8Base):
+#it covers RHEL8 and later
+class sysConfigEL(sysConfigAgentELBase):
     def __init__(self, glbEnv):
-        super(sysConfigRedhat9, self).__init__(glbEnv)
+        super(sysConfigEL, self).__init__(glbEnv)
         self.services = [hostConfig(self),
                          securityPolicyConfigRedhat(self),
                          networkConfigRedhat(self),
diff --git a/python/lib/cloudutils/utilities.py b/python/lib/cloudutils/utilities.py
index a0167461a3..5a6114f101 100755
--- a/python/lib/cloudutils/utilities.py
+++ b/python/lib/cloudutils/utilities.py
@@ -120,6 +120,10 @@ class Distribution:
                 version.find("CentOS Linux release 8") != -1 or version.find("CentOS release 8.") != -1 or
                 version.find("Linux release 8") != -1):
                 self.distro = "RHEL8"
+            elif (version.find("Red Hat Enterprise Linux Server release 9") != -1 or version.find("Scientific Linux release 9") != -1 or
+                version.find("Red Hat Enterprise Linux release 9") != -1 or version.find("Linux release 9.") != -1 or
+                version.find("Linux release 9") != -1):
+                self.distro = "RHEL9"
             elif version.find("CentOS") != -1:
                 self.distro = "CentOS"
             else: