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 2015/12/23 12:48:43 UTC

[2/2] ambari git commit: AMBARI-14199. Ambari Agent should not rely on CWD of user who started it (aonishuk)

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/94027262
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/94027262
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/94027262

Branch: refs/heads/branch-2.2
Commit: 940272628dcc87f0efa2e3ab96e6b971b13ee650
Parents: bdea165
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Dec 23 13:48:38 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Dec 23 13:48:38 2015 +0200

----------------------------------------------------------------------
 ambari-agent/conf/unix/ambari-agent | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/94027262/ambari-agent/conf/unix/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent
index c0760ec..c54af21 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// }