ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [20/50] [abbrv] ambari git commit: AMBARI-12510. ambari-server failed to properly detect of postgresql database status on RHEL 7.x (Tuong Truong via smohanty)
Date Wed, 30 Sep 2015 14:45:40 GMT
AMBARI-12510. ambari-server failed to properly detect of postgresql database status on RHEL
7.x (Tuong Truong via smohanty)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7e2a1c0e24ed9bf1656a31b80b6e2d752739a350
Parents: 67b9d48
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Fri Sep 25 15:38:07 2015 -0700
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Fri Sep 25 15:38:07 2015 -0700

----------------------------------------------------------------------
 .../main/python/ambari_server/dbConfiguration_linux.py  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7e2a1c0e/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
index 0abd28e..b2e9508 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
@@ -551,10 +551,14 @@ class PGConfig(LinuxDBMSConfig):
   @staticmethod
   def _get_postgre_status():
     retcode, out, err = run_os_command(PGConfig.PG_ST_CMD)
-    try:
-      pg_status = re.search('(stopped|running)', out, re.IGNORECASE).group(0).lower()
-    except AttributeError:
-      pg_status = None
+    # on RHEL and SUSE PG_ST_COMD returns RC 0 for running and 3 for stoppped
+    if retcode == 0:
+      pg_status = PGConfig.PG_STATUS_RUNNING
+    else:
+      if retcode == 3:
+        pg_status = "stopped"
+      else:
+        pg_status = None
     return pg_status, retcode, out, err
 
   @staticmethod


Mime
View raw message