Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 40d2d4d7c -> 58451d8a6
  refs/heads/trunk 76c4c4a5a -> a676f6634


AMBARI-6288. ambari-server may kill INIT and SSHD process (in some specific 
scenarios) (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: a676f6634b318f9cb3153dbd51c166e2143687c9
Parents: 76c4c4a
Author: Lisnichenko Dmitro <dlysniche...@hortonworks.com>
Authored: Thu Jun 26 20:30:12 2014 +0300
Committer: Lisnichenko Dmitro <dlysniche...@hortonworks.com>
Committed: Thu Jun 26 20:32:49 2014 +0300

----------------------------------------------------------------------
 ambari-server/src/main/python/ambari-server.py | 18 ++++++++++--------
 ambari-server/src/main/python/setupAgent.py    |  4 ++--
 2 files changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a676f663/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py 
b/ambari-server/src/main/python/ambari-server.py
index 7987b95..8edc29d 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -116,6 +116,7 @@ JAVA_SHARE_PATH = "/usr/share/java"
 SERVER_OUT_FILE = "/var/log/ambari-server/ambari-server.out"
 SERVER_LOG_FILE = "/var/log/ambari-server/ambari-server.log"
 BLIND_PASSWORD = "*****"
+ROOT_FS_PATH = "/"
 
 # terminal styles
 BOLD_ON = '\033[1m'
@@ -1117,7 +1118,7 @@ def check_postgre_up():
       if pg_status == PG_STATUS_RUNNING:
         return pg_status, 0, out, err
       else:
-        print_error_msg("Postgres start failed. " + str(e))    
+        print_error_msg("Postgres start failed. " + str(e))
     return pg_status, retcode, out, err
 
 
@@ -1403,7 +1404,7 @@ def execute_remote_script(args, scriptPath):
     # args.warnings.append('{0} not found. Please, run DDL script 
manually'.format(DATABASE_CLI_TOOLS[DATABASE_INDEX]))
     if VERBOSE:
       print_warning_msg('{0} not 
found'.format(DATABASE_CLI_TOOLS[DATABASE_INDEX]))
-    return -1, "Client wasn't found", "Client wasn't found"  
+    return -1, "Client wasn't found", "Client wasn't found"
   CMD = get_remote_script_line(args, scriptPath, False)
   if CMD:
     retcode, out, err = run_in_shell(CMD)
@@ -1417,7 +1418,7 @@ def get_remote_script_line(args, scriptPath, 
forPrint=True):
   if not tool:
     # args.warnings.append('{0} not found. Please, run DDL script 
manually'.format(DATABASE_CLI_TOOLS[DATABASE_INDEX]))
     if VERBOSE or args.persistence_type == "remote":
-      print_warning_msg('{0} not 
found'.format(DATABASE_CLI_TOOLS[DATABASE_INDEX]))  
+      print_warning_msg('{0} not 
found'.format(DATABASE_CLI_TOOLS[DATABASE_INDEX]))
     return None
   if args.dbms == "postgres":
     os.environ["PGPASSWORD"] = args.database_password
@@ -2392,7 +2393,7 @@ def reset(args):
 
   check_database_name_property()
   parse_properties_file(args)
-  
+
   if args.persistence_type == "remote":
     client_usage_cmd_drop = get_remote_script_line(args, 
DATABASE_DROP_SCRIPTS[DATABASE_INDEX])
     client_usage_cmd_init = get_remote_script_line(args, 
DATABASE_INIT_SCRIPTS[DATABASE_INDEX])
@@ -2572,19 +2573,20 @@ def start(args):
                            command_base.format(jdk_path,
                                                conf_dir,
                                                get_ambari_classpath(),
-                                               pidfile,
                                                os.path.join(PID_DIR, 
EXITCODE_NAME))
                            )
   if not os.path.exists(PID_DIR):
     os.makedirs(PID_DIR, 0755)
 
-    #For properly daemonization server should be started using shell as parent
+  # required to start properly server instance
+  os.chdir(ROOT_FS_PATH)
+
+  #For properly daemonization server should be started using shell as parent
   if is_root() and ambari_user != "root":
     # To inherit exported environment variables (especially AMBARI_PASSPHRASE),
     # from subprocess, we have to skip --login option of su command. That's why
     # we change dir to / (otherwise subprocess can face with 'permission 
denied'
     # errors while trying to list current directory
-    os.chdir("/")
     param_list = [utils.locate_file('su', '/bin'), ambari_user, "-s", 
utils.locate_file('sh', '/bin'), "-c", command]
   else:
     param_list = [utils.locate_file('sh', '/bin'), "-c", command]
@@ -2643,7 +2645,7 @@ def upgrade_stack(args, stack_id, repo_url=None, 
repo_url_os=None):
 
   if not retcode == 0:
     raise FatalException(retcode, 'Stack upgrade failed.')
-  
+
   return retcode
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a676f663/ambari-server/src/main/python/setupAgent.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/setupAgent.py 
b/ambari-server/src/main/python/setupAgent.py
index 1fad46a..e83ed3f 100755
--- a/ambari-server/src/main/python/setupAgent.py
+++ b/ambari-server/src/main/python/setupAgent.py
@@ -200,9 +200,9 @@ def main(argv=None):
     retcode = getOptimalVersion("")
   else:
     retcode = getOptimalVersion(projectVersion)
-  
+
   tryStopAgent()
-  
+
   if retcode["exitstatus"] == 0 and retcode["log"] != None and retcode["log"] 
!= "" and retcode["log"][0].strip() != "":
       availiableProjectVersion = retcode["log"].strip()
       if not isAgentPackageAlreadyInstalled(availiableProjectVersion):

Reply via email to