rhtyd commented on a change in pull request #2896: add exitcode / distribution
detection and remove export CGROUP_DAEMON for RHEL7/CentOS7
URL: https://github.com/apache/cloudstack/pull/2896#discussion_r228011566
##########
File path: python/lib/cloudutils/serviceConfig.py
##########
@@ -23,6 +23,29 @@
import os
import shutil
+# exit() error constants
+Unknown = 0
+CentOS6 = 1
+CentOS7 = 2
+Ubuntu = 3
+RHEL6 = 4
+RHEL7 = 5
+
+#=================== DISTRIBUTION DETECTION =================
+if os.path.exists("/etc/redhat-release"):
+ version = file("/etc/redhat-release").readline()
+ if version.find("Red Hat Enterprise Linux Server release 6") != -1:
+ distro = RHEL6
+ elif version.find("Red Hat Enterprise Linux Server 7") != -1:
+ distro = RHEL7
+ elif version.find("CentOS release 6") != -1:
+ distro = CentOS6
+ elif version.find("CentOS Linux release 7") != -1:
+ distro = CentOS7
+elif os.path.exists("/etc/legal") and "Ubuntu" in file("/etc/legal").read(-1):
distro = Ubuntu
Review comment:
instead of `/etc/legal` perhaps `/etc/lsb-release` could be used for
Ubuntu/Debian.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services