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/04/19 11:47:50 UTC

[ambari] branch trunk updated: AMBARI-23621. Ambari-server setup fails on Amazonlinux2 (aonishuk)

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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new edc9e34  AMBARI-23621. Ambari-server setup fails on Amazonlinux2 (aonishuk)
edc9e34 is described below

commit edc9e341b324e8c5ff6b58c40ada098265e819cf
Author: Andrew Onishuk <ao...@hortonworks.com>
AuthorDate: Thu Apr 19 10:29:51 2018 +0300

    AMBARI-23621. Ambari-server setup fails on Amazonlinux2 (aonishuk)
---
 ambari-server/src/main/python/ambari_server/utils.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/ambari-server/src/main/python/ambari_server/utils.py b/ambari-server/src/main/python/ambari_server/utils.py
index fcba7f1..e5cb828 100644
--- a/ambari-server/src/main/python/ambari_server/utils.py
+++ b/ambari-server/src/main/python/ambari_server/utils.py
@@ -36,6 +36,7 @@ logger = logging.getLogger(__name__)
 # PostgreSQL settings
 PG_STATUS_RUNNING_DEFAULT = "running"
 PG_HBA_ROOT_DEFAULT = "/var/lib/pgsql/data"
+PG_HBA_ROOT_DEFAULT_VERSIONED = "/var/lib/pgsql/*/data"
 
 #Environment
 ENV_PATH_DEFAULT = ['/bin', '/usr/bin', '/sbin', '/usr/sbin']  # default search path
@@ -259,9 +260,7 @@ def get_postgre_hba_dir(OS_FAMILY):
     # Like: /etc/postgresql/9.1/main/
     return os.path.join(get_pg_hba_init_files(), get_ubuntu_pg_version(),
                         "main")
-  elif not glob.glob(get_pg_hba_init_files() + '*'): # this happens when the service file is of new format (/usr/lib/systemd/system/postgresql.service)
-    return PG_HBA_ROOT_DEFAULT
-  else:
+  elif glob.glob(get_pg_hba_init_files() + '*'): # this happens when the service file is of old format (not like /usr/lib/systemd/system/postgresql.service)
     if not os.path.isfile(get_pg_hba_init_files()):
       # Link: /etc/init.d/postgresql --> /etc/init.d/postgresql-9.1
       os.symlink(glob.glob(get_pg_hba_init_files() + '*')[0],
@@ -279,8 +278,13 @@ def get_postgre_hba_dir(OS_FAMILY):
 
     if PG_HBA_ROOT and len(PG_HBA_ROOT.strip()) > 0:
       return PG_HBA_ROOT.strip()
-    else:
-      return PG_HBA_ROOT_DEFAULT
+
+  if not os.path.exists(PG_HBA_ROOT_DEFAULT):
+    versioned_dirs = glob.glob(PG_HBA_ROOT_DEFAULT_VERSIONED)
+    if versioned_dirs:
+      return versioned_dirs[0]
+
+  return PG_HBA_ROOT_DEFAULT
 
 
 def get_postgre_running_status():

-- 
To stop receiving notification emails like this one, please contact
aonishuk@apache.org.