AMBARI-14199. Ambari Agent should not rely on CWD of user who started it (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8eb449b4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8eb449b4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8eb449b4 Branch: refs/heads/branch-dev-patch-upgrade Commit: 8eb449b46b5bfc0ad6c54b0b340b0ff2354fbc06 Parents: 9c94ac9 Author: Andrew Onishuk <[email protected]> Authored: Wed Dec 23 13:48:35 2015 +0200 Committer: Andrew Onishuk <[email protected]> Committed: Wed Dec 23 13:48:35 2015 +0200 ---------------------------------------------------------------------- ambari-agent/conf/unix/ambari-agent | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8eb449b4/ambari-agent/conf/unix/ambari-agent ---------------------------------------------------------------------- diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent index 402ea7d..fbe99fa 100755 --- a/ambari-agent/conf/unix/ambari-agent +++ b/ambari-agent/conf/unix/ambari-agent @@ -45,6 +45,7 @@ PIDFILE=/var/run/ambari-agent/$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 +AGENT_TMP_DIR=/var/lib/ambari-agent/tmp AMBARI_AGENT_PY_SCRIPT=/usr/lib/python2.6/site-packages/ambari_agent/AmbariAgent.py OK=1 NOTOK=0 @@ -59,6 +60,9 @@ if [ "$EUID" -ne 0 ] ; then fi fi +# set reliable cwd for this and child processes. +cd $AGENT_TMP_DIR + keysdir=$(awk -F "=" '/keysdir/ {print $2}' /etc/ambari-agent/conf/ambari-agent.ini) # trim spaces keysdir=${keysdir// }
