You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by lp...@apache.org on 2017/09/12 10:04:49 UTC

[32/57] [abbrv] ambari git commit: AMBARI-21914 Agent on ambari-server host does not start when server is not upgraded (dsen)

AMBARI-21914 Agent on ambari-server host does not start when server is not upgraded (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4fa4f806
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4fa4f806
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4fa4f806

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 4fa4f806751b267983d24769b04b06dd153273a5
Parents: e142dcb
Author: Dmytro Sen <ds...@apache.org>
Authored: Fri Sep 8 16:52:22 2017 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Fri Sep 8 16:52:22 2017 +0300

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa4f806/ambari-agent/conf/unix/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent
index 70f58ed..f010800 100755
--- a/ambari-agent/conf/unix/ambari-agent
+++ b/ambari-agent/conf/unix/ambari-agent
@@ -83,6 +83,8 @@ AGENT_SCRIPT=/usr/lib/python2.6/site-packages/ambari_agent/main.py
 AGENT_TMP_DIR=/var/lib/ambari-agent/tmp
 AGENT_WORKING_DIR=/var/lib/ambari-agent
 AMBARI_AGENT_PY_SCRIPT=/usr/lib/python2.6/site-packages/ambari_agent/AmbariAgent.py
+COMMON_DIR=/usr/lib/python2.6/site-packages/ambari_commons
+COMMON_DIR_AGENT=/usr/lib/ambari-agent/lib/ambari_commons
 OK=0
 NOTOK=1
 
@@ -165,6 +167,19 @@ check_python_version ()
   return $OK
 }
 
+check_ambari_common_dir ()
+{
+  echo "Checking ambari-common dir..."
+  # recursively compare all files except 'pyc' and 'pyo' in agent common dir and actual common dir to ensure they are up to date
+  diff -r $COMMON_DIR $COMMON_DIR_AGENT -x '*.py?'
+  OUT=$?
+  if [ $OUT -ne 0 ];then
+    echo "ERROR: ambari_commons folder mismatch. $COMMON_DIR content should be the same as $COMMON_DIR_AGENT. Either ambari-agent is co-hosted with ambari-server and agent was upgraded without server or the link was broken."
+    return $NOTOK
+  fi
+  return $OK
+}
+
 retcode=0
 
 case "${1:-}" in
@@ -189,6 +204,11 @@ case "${1:-}" in
         fi
         change_files_permissions
 
+        check_ambari_common_dir
+        if [ "$?" -eq "$NOTOK" ]; then
+          exit -1
+        fi
+
         echo "Starting ambari-agent"
 
         if [ "${AMBARI_AGENT_RUN_IN_FOREGROUND:-}" == true ] ; then