You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2018/08/10 12:00:23 UTC

[ambari] branch branch-2.7 updated: AMBARI-24456. Ambari server can not start on latest Amazon Linux 2 (aonishuk)

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

aonishuk pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 853fa62  AMBARI-24456. Ambari server can not start on latest Amazon Linux 2 (aonishuk)
853fa62 is described below

commit 853fa627eb00a17dbd32ffd796edce3786d812d7
Author: Andrew Onishuk <ao...@hortonworks.com>
AuthorDate: Fri Aug 10 11:19:41 2018 +0300

    AMBARI-24456. Ambari server can not start on latest Amazon Linux 2 (aonishuk)
---
 ambari-common/src/main/python/ambari_commons/os_check.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/ambari-common/src/main/python/ambari_commons/os_check.py b/ambari-common/src/main/python/ambari_commons/os_check.py
index d9097a1..e242d7b 100644
--- a/ambari-common/src/main/python/ambari_commons/os_check.py
+++ b/ambari-common/src/main/python/ambari_commons/os_check.py
@@ -78,7 +78,7 @@ VER_NT_SERVER = 3
 _IS_ORACLE_LINUX = os.path.exists('/etc/oracle-release')
 _IS_REDHAT_LINUX = os.path.exists('/etc/redhat-release')
 
-SYSTEM_RELEASE_FILE = "/etc/system-release"
+OS_RELEASE_FILE = "/etc/os-release"
 
 def _is_oracle_linux():
   return _IS_ORACLE_LINUX
@@ -91,13 +91,16 @@ def _is_powerpc():
 
 def advanced_check(distribution):
   distribution = list(distribution)
-  if os.path.exists(SYSTEM_RELEASE_FILE):
-    with open(SYSTEM_RELEASE_FILE, "rb") as fp:
-      issue_content = fp.read()
+  if os.path.exists(OS_RELEASE_FILE):
+    with open(OS_RELEASE_FILE, "rb") as fp:
+      file_content = fp.read()
   
-    if "Amazon" in issue_content:
+    search_groups = re.search('NAME="(.+)"', file_content)
+    name = search_groups.group(1) if search_groups else ''
+
+    if "amazon" in name.lower():
       distribution[0] = "amazonlinux"
-      search_groups = re.search(' release (\d+)', issue_content)
+      search_groups = re.search('VERSION_ID="(\d+)"', file_content)
       
       if search_groups:
         distribution[1] = search_groups.group(1)