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 2016/09/01 09:22:59 UTC
[2/3] ambari git commit: AMBARI-18294. Ambari Server Start/Stop fails
on Centos 7.1+ (aonishuk)
AMBARI-18294. Ambari Server Start/Stop fails on Centos 7.1+ (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6479f2d2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6479f2d2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6479f2d2
Branch: refs/heads/branch-2.4
Commit: 6479f2d29ada35e5c69f529021f84398f8f45c08
Parents: d828375
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Sep 1 12:22:49 2016 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Sep 1 12:22:49 2016 +0300
----------------------------------------------------------------------
.../src/main/python/ambari_server/utils.py | 16 ++++++++++++++++
ambari-server/src/main/python/ambari_server_main.py | 8 ++++----
2 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6479f2d2/ambari-server/src/main/python/ambari_server/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/utils.py b/ambari-server/src/main/python/ambari_server/utils.py
index c4990f5..012d428 100644
--- a/ambari-server/src/main/python/ambari_server/utils.py
+++ b/ambari-server/src/main/python/ambari_server/utils.py
@@ -63,6 +63,22 @@ def locate_file(filename, default=''):
else:
return filename
+def locate_all_file_paths(filename, default=''):
+ """Locate command possible paths according to OS environment"""
+ paths = []
+ for path in ENV_PATH:
+ path = os.path.join(path, filename)
+ if os.path.isfile(path):
+ paths.append(path)
+
+ if not paths:
+ if default != '':
+ return [os.path.join(default, filename)]
+ else:
+ return [filename]
+
+ return paths
+
def check_exitcode(exitcode_file_path):
"""
http://git-wip-us.apache.org/repos/asf/ambari/blob/6479f2d2/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 17945de..9e04a5d 100644
--- a/ambari-server/src/main/python/ambari_server_main.py
+++ b/ambari-server/src/main/python/ambari_server_main.py
@@ -37,7 +37,7 @@ from ambari_server.serverUtils import refresh_stack_hash
from ambari_server.setupHttps import get_fqdn
from ambari_server.setupSecurity import generate_env, \
ensure_can_start_under_current_user
-from ambari_server.utils import check_reverse_lookup, save_pid, locate_file, looking_for_pid, wait_for_pid, \
+from ambari_server.utils import check_reverse_lookup, save_pid, locate_file, locate_all_file_paths, looking_for_pid, wait_for_pid, \
save_main_pid_ex, check_exitcode
from ambari_server.serverClassPath import ServerClassPath
@@ -209,9 +209,9 @@ def wait_for_server_start(pidFile, scmStatus):
exitcode = check_exitcode(os.path.join(configDefaults.PID_DIR, EXITCODE_NAME))
raise FatalException(-1, AMBARI_SERVER_DIE_MSG.format(exitcode, configDefaults.SERVER_OUT_FILE))
else:
- save_main_pid_ex(pids, pidFile, [locate_file('sh', '/bin'),
- locate_file('bash', '/bin'),
- locate_file('dash', '/bin')], True, IS_FOREGROUND)
+ save_main_pid_ex(pids, pidFile, locate_all_file_paths('sh', '/bin') +
+ locate_all_file_paths('bash', '/bin') +
+ locate_all_file_paths('dash', '/bin'), True, IS_FOREGROUND)
def server_process_main(options, scmStatus=None):