AMBARI-16989. Ambari-server fails to start after reboot on Ubuntu (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3433bbfc Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3433bbfc Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3433bbfc Branch: refs/heads/branch-2.4 Commit: 3433bbfcff52a00af2f94a82dacee3abfcf1875d Parents: 132764e Author: Andrew Onishuk <[email protected]> Authored: Thu Jun 2 13:07:37 2016 +0300 Committer: Andrew Onishuk <[email protected]> Committed: Thu Jun 2 13:07:37 2016 +0300 ---------------------------------------------------------------------- .../src/main/python/ambari_server/serverConfiguration.py | 9 ++++++++- ambari-server/src/main/python/ambari_server_main.py | 4 ---- 2 files changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/3433bbfc/ambari-server/src/main/python/ambari_server/serverConfiguration.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py b/ambari-server/src/main/python/ambari_server/serverConfiguration.py index c28909e..6e14b43 100644 --- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py +++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py @@ -390,8 +390,15 @@ class ServerConfigDefaults(object): def check_if_directories_writable(self, directories): for directory in directories: + if not os.path.isdir(directory): + try: + os.makedirs(directory, 0755) + except Exception as ex: + # permission denied here is expected when ambari runs as non-root + print_info_msg("Could not create {0}. Reason: {1}".format(directory, ex)) + if not os.path.isdir(directory) or not os.access(directory, os.W_OK): - raise FatalException(-1, "Unable to access {0} directory. Confirm the directory is created and is writable by the Ambari Server user account '{1}'".format(directory, getpass.getuser())) + raise FatalException(-1, "Unable to access {0} directory. Confirm the directory is created and is writable by Ambari Server user account '{1}'".format(directory, getpass.getuser())) @OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY) class ServerConfigDefaultsWindows(ServerConfigDefaults): http://git-wip-us.apache.org/repos/asf/ambari/blob/3433bbfc/ambari-server/src/main/python/ambari_server_main.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server_main.py b/ambari-server/src/main/python/ambari_server_main.py index a5e6f81..17945de 100644 --- a/ambari-server/src/main/python/ambari_server_main.py +++ b/ambari-server/src/main/python/ambari_server_main.py @@ -317,10 +317,6 @@ def server_process_main(options, scmStatus=None): update_properties(properties) param_list = generate_child_process_param_list(ambari_user, java_exe, class_path, debug_start, suspend_mode) - - if not os.path.exists(configDefaults.PID_DIR): - os.makedirs(configDefaults.PID_DIR, 0755) - # The launched shell process and sub-processes should have a group id that # is different from the parent. def make_process_independent():
