ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject ambari git commit: AMBARI-15947 Upgrading Ambari should delete any pyc files (dlysnichenko)
Date Tue, 19 Apr 2016 12:06:50 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 8b92561fb -> 9d4e0228f


AMBARI-15947 Upgrading Ambari should delete any pyc files (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 9d4e0228fee794dd729743679fbd5cee0609a8cc
Parents: 8b92561
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Tue Apr 19 15:06:27 2016 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Tue Apr 19 15:06:27 2016 +0300

----------------------------------------------------------------------
 ambari-agent/conf/unix/install-helper.sh  | 25 +++++++++++++++++++++----
 ambari-server/conf/unix/install-helper.sh | 15 +++++++++++++++
 2 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9d4e0228/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 2495080..04f1e49 100644
--- a/ambari-agent/conf/unix/install-helper.sh
+++ b/ambari-agent/conf/unix/install-helper.sh
@@ -28,8 +28,18 @@ COMMON_DIR_AGENT="/usr/lib/ambari-agent/lib/ambari_commons"
 RESOURCE_MANAGEMENT_DIR_AGENT="/usr/lib/ambari-agent/lib/resource_management"
 JINJA_AGENT_DIR="/usr/lib/ambari-agent/lib/ambari_jinja2"
 SIMPLEJSON_AGENT_DIR="/usr/lib/ambari-agent/lib/ambari_simplejson"
-
+AMBARI_AGENT="/usr/lib/python2.6/site-packages/ambari_agent"
 PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap"
+AMBARI_AGENT_VAR="/var/lib/ambari-agent"
+
+clean_pyc_files(){
+  # cleaning old *.pyc files
+  find $RESOURCE_MANAGEMENT_DIR/ -name *.pyc -exec rm {} \;
+  find $COMMON_DIR/ -name *.pyc -exec rm {} \;
+  find $AMBARI_AGENT/ -name *.pyc -exec rm {} \;
+  find $AMBARI_AGENT_VAR/ -name *.pyc -exec rm {} \;
+}
+
 
 do_install(){
   if [ -d "/etc/ambari-agent/conf.save" ]; then
@@ -57,10 +67,14 @@ do_install(){
   
   # on nano Ubuntu, when umask=027 those folders are created without 'x' bit for 'others'.
   # which causes failures when hadoop users try to access tmp_dir
-  chmod a+x /var/lib/ambari-agent
+  chmod a+x $AMBARI_AGENT_VAR
   
-  chmod 777 /var/lib/ambari-agent/tmp
-  chmod 700 /var/lib/ambari-agent/data
+  chmod 777 $AMBARI_AGENT_VAR/tmp
+  chmod 700 $AMBARI_AGENT_VAR/data
+
+  #TODO we need this when upgrading from pre 2.4 versions to 2.4, remove this when upgrade
from pre 2.4 versions will be
+  #TODO unsupported
+  clean_pyc_files
 
   which chkconfig > /dev/null 2>&1
   if [ "$?" -eq 0 ] ; then
@@ -105,6 +119,9 @@ do_install(){
 
 do_remove(){
   /usr/sbin/ambari-agent stop > /dev/null 2>&1
+
+  clean_pyc_files
+
   if [ -d "/etc/ambari-agent/conf.save" ]; then
     mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save
   fi

http://git-wip-us.apache.org/repos/asf/ambari/blob/9d4e0228/ambari-server/conf/unix/install-helper.sh
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/install-helper.sh b/ambari-server/conf/unix/install-helper.sh
index 25a10d6..07c5e50 100644
--- a/ambari-server/conf/unix/install-helper.sh
+++ b/ambari-server/conf/unix/install-helper.sh
@@ -44,6 +44,14 @@ AMBARI_CONFIGS_DIR_SAVE="${ROOT}/etc/ambari-server/conf.save"
 AMBARI_CONFIGS_DIR_SAVE_BACKUP="${ROOT}/etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save"
 AMBARI_LOG4J="${AMBARI_CONFIGS_DIR}/log4j.properties"
 
+clean_pyc_files(){
+  # cleaning old *.pyc files
+  find $RESOURCE_MANAGEMENT_DIR/ -name *.pyc -exec rm {} \;
+  find $COMMON_DIR/ -name *.pyc -exec rm {} \;
+  find $AMBARI_SEVER/ -name *.pyc -exec rm {} \;
+}
+
+
 do_install(){
   rm -f "$AMBARI_SERVER_EXECUTABLE_LINK"
   ln -s "$AMBARI_SERVER_EXECUTABLE" "$AMBARI_SERVER_EXECUTABLE_LINK"
@@ -66,6 +74,10 @@ do_install(){
     ln -s "$SIMPLEJSON_SERVER_DIR" "$SIMPLEJSON_DIR"
   fi
 
+  #TODO we need this when upgrading from pre 2.4 versions to 2.4, remove this when upgrade
from pre 2.4 versions will be
+  #TODO unsupported
+  clean_pyc_files
+
   # remove old python wrapper
   rm -f "$PYTHON_WRAPER_TARGET"
 
@@ -123,6 +135,9 @@ do_install(){
 
 do_remove(){
   $AMBARI_SERVER_EXECUTABLE stop > /dev/null 2>&1
+
+  clean_pyc_files
+
   if [ -d "$AMBARI_CONFIGS_DIR_SAVE" ]; then
     mv "$AMBARI_CONFIGS_DIR_SAVE" "$AMBARI_CONFIGS_DIR_SAVE_BACKUP"
   fi


Mime
View raw message