Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 8bf7c2bbd -> 6bd63226c
  refs/heads/trunk 4432c1f75 -> a01d50b08


AMBARI-16711. hostname start to  have localhost value  in ambari-agent.ini file 
after upgrade from 2.2.0.0 to 2.4.0.0 (aonishuk)


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

Branch: refs/heads/trunk
Commit: a01d50b085e3b68e3c7494b3cb7ca5d8be0dea4e
Parents: 4432c1f
Author: Andrew Onishuk <aonis...@hortonworks.com>
Authored: Tue May 17 23:57:26 2016 +0300
Committer: Andrew Onishuk <aonis...@hortonworks.com>
Committed: Tue May 17 23:57:26 2016 +0300

----------------------------------------------------------------------
 ambari-agent/conf/unix/install-helper.sh | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a01d50b0/ambari-agent/conf/unix/install-helper.sh
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/install-helper.sh 
b/ambari-agent/conf/unix/install-helper.sh
index 8a5e1f1..3614659 100644
--- a/ambari-agent/conf/unix/install-helper.sh
+++ b/ambari-agent/conf/unix/install-helper.sh
@@ -85,16 +85,6 @@ do_install(){
     update-rc.d ambari-agent defaults
   fi
 
-  BAK=/etc/ambari-agent/conf/ambari-agent.ini.old
-  ORIG=/etc/ambari-agent/conf/ambari-agent.ini
-
-  if [ -f $BAK ]; then
-    if [ -f "/var/lib/ambari-agent/upgrade_agent_configs.py" ]; then
-      /var/lib/ambari-agent/upgrade_agent_configs.py
-    fi
-    mv $BAK ${BAK}_$(date '+%d_%m_%y_%H_%M').save
-  fi
-
   # remove old python wrapper
   rm -f "$PYTHON_WRAPER_TARGET"
 
@@ -110,10 +100,22 @@ do_install(){
     fi
   done
 
+  BAK=/etc/ambari-agent/conf/ambari-agent.ini.old
+  ORIG=/etc/ambari-agent/conf/ambari-agent.ini
+  UPGRADE_AGENT_CONFIGS_SCRIPT=/var/lib/ambari-agent/upgrade_agent_configs.py
+
   if [ -z "$AMBARI_PYTHON" ] ; then
-    >&2 echo "Cannot detect python for ambari to use. Please manually set 
$PYTHON_WRAPER link to point to correct python binary"
+    >&2 echo "Cannot detect python for Ambari to use. Please manually set 
$PYTHON_WRAPER_TARGET link to point to correct python binary"
+    >&2 echo "Cannot upgrade agent configs because python for Ambari is not 
configured. The old config file is saved as $BAK . Execution of 
$UPGRADE_AGENT_CONFIGS_SCRIPT was skipped."
   else
     ln -s "$AMBARI_PYTHON" "$PYTHON_WRAPER_TARGET"
+
+    if [ -f $BAK ]; then
+      if [ -f "$UPGRADE_AGENT_CONFIGS_SCRIPT" ]; then
+        $UPGRADE_AGENT_CONFIGS_SCRIPT
+      fi
+      mv $BAK ${BAK}_$(date '+%d_%m_%y_%H_%M').save
+    fi
   fi
 }
 

Reply via email to