From 3ce420c367363202cac4e4f5f59aac23d32defc7 Mon Sep 17 00:00:00 2001 From: Carles Figuerola Date: Wed, 4 Nov 2015 11:21:47 -0600 Subject: [PATCH] CLOUDSTACK-9029: Proper support to identify CentOS 7 version number --- python/lib/cloud_utils.py | 2 +- python/lib/cloudutils/utilities.py | 2 +- scripts/vm/hypervisor/versions.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/lib/cloud_utils.py b/python/lib/cloud_utils.py index 243bb408d41..598614f96dc 100644 --- a/python/lib/cloud_utils.py +++ b/python/lib/cloud_utils.py @@ -68,7 +68,7 @@ elif 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("CentOS release") != -1: + elif version.find("CentOS") != -1: distro = CentOS else: distro = CentOS diff --git a/python/lib/cloudutils/utilities.py b/python/lib/cloudutils/utilities.py index 88e2d1c6f9b..19dc7ed0da6 100755 --- a/python/lib/cloudutils/utilities.py +++ b/python/lib/cloudutils/utilities.py @@ -114,7 +114,7 @@ class Distribution: self.distro = "RHEL6" elif version.find("Red Hat Enterprise Linux Server release 7") != -1: self.distro = "RHEL7" - elif version.find("CentOS release") != -1: + elif version.find("CentOS") != -1: self.distro = "CentOS" else: self.distro = "RHEL5" diff --git a/scripts/vm/hypervisor/versions.sh b/scripts/vm/hypervisor/versions.sh index 159e78e13e8..5d8ff3c35ec 100755 --- a/scripts/vm/hypervisor/versions.sh +++ b/scripts/vm/hypervisor/versions.sh @@ -32,7 +32,7 @@ CODENAME="" if [ -f /etc/redhat-release ] ; then DIST=`cat /etc/redhat-release | awk '{print $1}'` CODENAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` - REV=`cat /etc/redhat-release | awk '{print $3}'` + REV=`cat /etc/redhat-release | awk '{print $3,$4}' | grep -o "[0-9.]*"` elif [ -f /etc/lsb-release ] ; then DIST=`cat /etc/lsb-release | grep DISTRIB_ID | tr "\n" ' '| sed s/.*=//` REV=`cat /etc/lsb-release | grep DISTRIB_RELEASE | tr "\n" ' '| sed s/.*=//`