From 1ca25d1fd5dcc64cf97611456146843b404c69ea Mon Sep 17 00:00:00 2001 From: Telles Nobrega Date: Wed, 20 Jun 2018 15:19:37 -0300 Subject: [PATCH] Fixing extjs check on cdh and mapr On images generated from sahara-image-elements cluster is being stuck due to double execution of the unzip code. This fix prevents the code to be executed twice and in the case it does we force unzip to overwrite. Change-Id: I73836a516b839bdb368997af3693c139c1fff390 Story: #2002551 Task: #22113 --- .../resources/images/common/configure_extjs | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/sahara/plugins/mapr/resources/images/common/configure_extjs b/sahara/plugins/mapr/resources/images/common/configure_extjs index ce49daf..2d46d9d 100644 --- a/sahara/plugins/mapr/resources/images/common/configure_extjs +++ b/sahara/plugins/mapr/resources/images/common/configure_extjs @@ -4,19 +4,27 @@ EXTJS_DESTINATION_DIR="/opt/mapr-repository" EXTJS_DOWNLOAD_URL="https://tarballs.openstack.org/sahara-extra/dist/common-artifacts/ext-2.2.zip" EXTJS_NO_UNPACK=1 -extjs_archive=/tmp/$(basename $EXTJS_DOWNLOAD_URL) +extjs_basepath=$(basename ${EXTJS_DOWNLOAD_URL}) +extjs_archive=/tmp/${extjs_basepath} +extjs_folder="${extjs_basepath%.*}" -if [ ! -f "${EXTJS_DESTINATION_DIR}/${extjs_archive}" ]; then - if [ $test_only -eq 0 ]; then - wget -O $extjs_archive $EXTJS_DOWNLOAD_URL +function setup_extjs { + wget -O $extjs_archive $EXTJS_DOWNLOAD_URL + mkdir -p $EXTJS_DESTINATION_DIR +} - mkdir -p $EXTJS_DESTINATION_DIR - if [ -z "${EXTJS_NO_UNPACK:-}" ]; then - unzip -d "$EXTJS_DESTINATION_DIR" $extjs_archive - rm -f $extjs_archive - else - mv $extjs_archive $EXTJS_DESTINATION_DIR - fi +if [ -z "${EXTJS_NO_UNPACK:-}" ]; then + if [ ! -d "${EXTJS_DESTINATION_DIR}/${extjs_folder}" ]; then + setup_extjs + unzip -o -d "$EXTJS_DESTINATION_DIR" $extjs_archive + rm -f $extjs_archive + else + exit 0 + fi +else + if [ ! -f "${EXTJS_DESTINATION_DIR}/${extjs_basepath}" ]; then + setup_extjs + mv $extjs_archive $EXTJS_DESTINATION_DIR else exit 0 fi