AMBARI-14643. Ambari agent dir is not recreated if /var/run/<ambari_dir> is deleted on non-root agent (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a251dca1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a251dca1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a251dca1 Branch: refs/heads/branch-dev-patch-upgrade Commit: a251dca1da9df22683370a32a84c772828501c96 Parents: ce40d28 Author: Andrew Onishuk <[email protected]> Authored: Wed Jan 13 09:19:16 2016 +0200 Committer: Andrew Onishuk <[email protected]> Committed: Wed Jan 13 09:19:16 2016 +0200 ---------------------------------------------------------------------- ambari-agent/conf/unix/ambari-agent | 6 ++++-- ambari-agent/src/main/python/ambari_agent/main.py | 6 ------ 2 files changed, 4 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a251dca1/ambari-agent/conf/unix/ambari-agent ---------------------------------------------------------------------- diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent index fbe99fa..4f9e1e5 100755 --- a/ambari-agent/conf/unix/ambari-agent +++ b/ambari-agent/conf/unix/ambari-agent @@ -41,7 +41,8 @@ export PYTHONPATH=/usr/lib/python2.6/site-packages:$PYTHONPATH AMBARI_AGENT=ambari-agent PYTHON_WRAP=/var/lib/ambari-agent/ambari-python-wrap -PIDFILE=/var/run/ambari-agent/$AMBARI_AGENT.pid +PIDDIR=/var/run/ambari-agent +PIDFILE=$PIDDIR/$AMBARI_AGENT.pid OUTFILE=/var/log/ambari-agent/ambari-agent.out LOGFILE=/var/log/ambari-agent/ambari-agent.log AGENT_SCRIPT=/usr/lib/python2.6/site-packages/ambari_agent/main.py @@ -72,7 +73,8 @@ change_files_permissions() { if [ ! -z "$keysdir" ]; then ambari-sudo.sh chown -R $current_user "$keysdir" fi - ambari-sudo.sh chown -R $current_user "/var/run/ambari-agent/" + ambari-sudo.sh mkdir -p "$PIDDIR" + ambari-sudo.sh chown -R $current_user "$PIDDIR" ambari-sudo.sh chown -R $current_user "/var/log/ambari-agent/" ambari-sudo.sh chown -R $current_user "/var/lib/ambari-agent/data/" ambari-sudo.sh chown -R $current_user "/var/lib/ambari-agent/cache/" http://git-wip-us.apache.org/repos/asf/ambari/blob/a251dca1/ambari-agent/src/main/python/ambari_agent/main.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/main.py b/ambari-agent/src/main/python/ambari_agent/main.py index b920410..2b50cbb 100644 --- a/ambari-agent/src/main/python/ambari_agent/main.py +++ b/ambari-agent/src/main/python/ambari_agent/main.py @@ -158,12 +158,6 @@ def perform_prestart_checks(expected_hostname): def daemonize(): - # Daemonize current instance of Ambari Agent - # Currently daemonization is done via /usr/sbin/ambari-agent script (nohup) - # and agent only dumps self pid to file - if not os.path.exists(ProcessHelper.piddir): - os.makedirs(ProcessHelper.piddir, 0755) - pid = str(os.getpid()) file(ProcessHelper.pidfile, 'w').write(pid)
