incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject svn commit: r1492426 - in /incubator/ambari/branches/branch-1.2.4: CHANGES.txt ambari-server/src/main/python/ambari-server.py
Date Wed, 12 Jun 2013 20:59:04 GMT
Author: swagle
Date: Wed Jun 12 20:59:03 2013
New Revision: 1492426

URL: http://svn.apache.org/r1492426
Log:
AMBARI-2369. B6 setup stops on Postgresql start on SLES11. (swagle)

Modified:
    incubator/ambari/branches/branch-1.2.4/CHANGES.txt
    incubator/ambari/branches/branch-1.2.4/ambari-server/src/main/python/ambari-server.py

Modified: incubator/ambari/branches/branch-1.2.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2.4/CHANGES.txt?rev=1492426&r1=1492425&r2=1492426&view=diff
==============================================================================
--- incubator/ambari/branches/branch-1.2.4/CHANGES.txt (original)
+++ incubator/ambari/branches/branch-1.2.4/CHANGES.txt Wed Jun 12 20:59:03 2013
@@ -910,6 +910,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2369. B6 setup stops on Postgresql start on SLES11. (swagle)
+
  AMBARI-2263. Render appropriate default values for HBase java settings. (jaimin)
  
  AMBARI-2230. Nagios user is presented in Admin > Misc page when Nagios

Modified: incubator/ambari/branches/branch-1.2.4/ambari-server/src/main/python/ambari-server.py
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2.4/ambari-server/src/main/python/ambari-server.py?rev=1492426&r1=1492425&r2=1492426&view=diff
==============================================================================
--- incubator/ambari/branches/branch-1.2.4/ambari-server/src/main/python/ambari-server.py
(original)
+++ incubator/ambari/branches/branch-1.2.4/ambari-server/src/main/python/ambari-server.py
Wed Jun 12 20:59:03 2013
@@ -155,7 +155,7 @@ PROMPT_DATABASE_OPTIONS = False
 USERNAME_PATTERN = "^[a-zA-Z_][a-zA-Z0-9_\-]*$"
 PASSWORD_PATTERN = "^[a-zA-Z0-9_-]*$"
 DATABASE_NAMES =["postgres", "oracle"]
-DATABASE_STORAGE_NAMES =["database","service","schema"]
+DATABASE_STORAGE_NAMES =["Database","Service","Schema"]
 DATABASE_PORTS =["5432", "1521", "3306"]
 DATABASE_DRIVER_NAMES = ["org.postgresql.Driver", "oracle.jdbc.driver.OracleDriver", "com.mysql.jdbc.Driver"]
 DATABASE_CONNECTION_STRINGS = ["jdbc:postgresql://{0}:{1}/{2}", "jdbc:oracle:thin:@{0}:{1}/{2}",
"jdbc:mysql://{0}:{1}/{2}"]
@@ -681,7 +681,6 @@ def get_postgre_status():
   return pg_status 
 
 
-
 def check_postgre_up():
   pg_status = get_postgre_status()
   if pg_status == PG_STATUS_RUNNING:
@@ -693,9 +692,32 @@ def check_postgre_up():
     if retcode == 0:
       print out
     print "About to start PostgreSQL"
-    retcode, out, err = run_os_command(PG_START_CMD)
-    return retcode
+    try:
+      process = subprocess.Popen(PG_START_CMD.split(' '),
+        stdout=subprocess.PIPE,
+        stdin=subprocess.PIPE,
+        stderr=subprocess.PIPE
+      )
+      time.sleep(5)
+      result = process.poll()
+      print_info_msg("Result of postgres start cmd: " + str(result))
+      if result is None:
+        process.kill()
+        pg_status = get_postgre_status()
+        if pg_status == PG_STATUS_RUNNING:
+          print_info_msg("Postgres process is running. Returning...")
+          return 0
+      else:
+        retcode = result
+    except (Exception), e:
+      pg_status = get_postgre_status()
+      if pg_status == PG_STATUS_RUNNING:
+        return 0
+      else:
+        print_error_msg("Postgres start failed. " + str(e))
+        return 1
 
+    return retcode
 
 
 #
@@ -1271,7 +1293,7 @@ def prompt_db_properties(args):
         pass
 
       args.database_name = get_validated_string_input(
-        DATABASE_STORAGE_NAMES[DATABASE_INDEX] + " name [" + args.database_name + "]:",
+        DATABASE_STORAGE_NAMES[DATABASE_INDEX] + " Name [" + args.database_name + "]:",
         args.database_name,
         "^[a-zA-z\-\"]+$",
         "Invalid " + DATABASE_STORAGE_NAMES[DATABASE_INDEX] + " name.",



Mime
View raw message