When there's nothing to do, exit without trying to build the script.

This commit is contained in:
Andrea Dell'Amico 2017-07-26 17:17:06 +02:00
parent 27f3a4f000
commit 925d545be2
1 changed files with 13 additions and 8 deletions

View File

@ -22,6 +22,7 @@ trap "logger 'algorithms-updater: trap intercepted, exiting.' ; cleanup 1" SIGHU
function cleanup() { function cleanup() {
rm -fr $OUT_DIR rm -fr $OUT_DIR
rm -f $LOCK_FILE rm -f $LOCK_FILE
logger 'algorithms-updater: Exiting'
exit $1 exit $1
} }
@ -103,15 +104,19 @@ function algorithms_updater() {
done < ${ALGORITHMS_TEMP_SCRIPT}.algorithmslist done < ${ALGORITHMS_TEMP_SCRIPT}.algorithmslist
set -o pipefail set -o pipefail
set -e set -e
mv $ALGORITHMS_TEMP_SCRIPT.body_ $ALGORITHMS_TEMP_SCRIPT.body if [ -f $ALGORITHMS_TEMP_SCRIPT.body_ ] ; then
cat $ALGORITHMS_TEMP_SCRIPT.head $ALGORITHMS_TEMP_SCRIPT.body > $ALGORITHMS_TEMP_SCRIPT mv $ALGORITHMS_TEMP_SCRIPT.body_ $ALGORITHMS_TEMP_SCRIPT.body
chmod 755 $ALGORITHMS_TEMP_SCRIPT cat $ALGORITHMS_TEMP_SCRIPT.head $ALGORITHMS_TEMP_SCRIPT.body > $ALGORITHMS_TEMP_SCRIPT
if [ -x $ADD_ALGORITHM_PATH ] ; then chmod 755 $ALGORITHMS_TEMP_SCRIPT
logger 'algorithms-updater: add the algorithms configurations. Reference infra is {{ dataminer_infra_reference }}' if [ -x $ADD_ALGORITHM_PATH ] ; then
$ALGORITHMS_TEMP_SCRIPT >> $LOG_FILE 2>&1 logger 'algorithms-updater: add the algorithms configurations. Reference infra is {{ dataminer_infra_reference }}'
$ALGORITHMS_TEMP_SCRIPT >> $LOG_FILE 2>&1
else
logger 'algorithms-updater: {{ smartgears_user_home }}/algorithmInstaller/addAlgorithm.sh is not an executable, aborting'
cleanup 1
fi
else else
logger 'algorithms-updater: {{ smartgears_user_home }}/algorithmInstaller/addAlgorithm.sh is not an executable, aborting' cleanup 0
cleanup 1
fi fi
} }