IMPALA-6517: bootstrap_toolchain.py fails to recognize lsb_release
output from RHEL OS

The OS map that we currently use to check platform/OS release
against in bootstrap_toolchain.py does not contain key-value pairs
for Redhat platforms.
e.g.
lsb_release -irs
RedHatEnterpriseServer 6.9

This change adds RHEL5, RHEL6 and RHEL7 to the OS map. It also
relaxes the matching criteria for RHEL and CentOS to only major
version.

Testing: I manually cloned a repo locally and called
bootstrap_toolchain.py to verify that it can detect the platform.
Testing was done against RHEL6, RHEL7, Ubuntu16.04 and Centos7.

Change-Id: I83874220bd424a452df49520b5dad7bfa2124ca6
Reviewed-on: http://gerrit.cloudera.org:8080/9310
Reviewed-by: Lars Volker <l...@cloudera.com>
Reviewed-by: Philip Zeyliger <phi...@cloudera.com>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/d89db5b0
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/d89db5b0
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/d89db5b0

Branch: refs/heads/2.x
Commit: d89db5b0dc797c82a0c38fe3e563b1cda3603c5a
Parents: 11e0bed
Author: Vincent Tran <vtt...@cloudera.com>
Authored: Tue Feb 13 15:58:49 2018 -0500
Committer: Impala Public Jenkins <impala-public-jenk...@gerrit.cloudera.org>
Committed: Thu Feb 22 06:29:53 2018 +0000

----------------------------------------------------------------------
 bin/bootstrap_toolchain.py | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/d89db5b0/bin/bootstrap_toolchain.py
----------------------------------------------------------------------
diff --git a/bin/bootstrap_toolchain.py b/bin/bootstrap_toolchain.py
index 8494c6c..8cee665 100755
--- a/bin/bootstrap_toolchain.py
+++ b/bin/bootstrap_toolchain.py
@@ -51,6 +51,9 @@ OS_MAPPING = {
   "centos6" : "ec2-package-centos-6",
   "centos5" : "ec2-package-centos-5",
   "centos7" : "ec2-package-centos-7",
+  "redhatenterpriseserver5" :  "ec2-package-centos-5",
+  "redhatenterpriseserver6" :  "ec2-package-centos-6",
+  "redhatenterpriseserver7" :  "ec2-package-centos-7",
   "debian6" : "ec2-package-debian-6",
   "debian7" : "ec2-package-debian-7",
   "debian8" : "ec2-package-debian-8",
@@ -107,6 +110,11 @@ def get_platform_release_label(release=None):
       release = lsb_release_cache
     else:
       release = "".join(map(lambda x: x.lower(), 
sh.lsb_release("-irs").split()))
+      # Only need to check against the major release if RHEL or CentOS
+      for platform in ['centos', 'redhatenterpriseserver']:
+        if platform in release:
+          release = release.split('.')[0]
+          break
       lsb_release_cache = release
   for k, v in OS_MAPPING.iteritems():
     if re.search(k, release):

Reply via email to