From 894b99b6a2ea7dc5820493f938edb1f3414b6d3b Mon Sep 17 00:00:00 2001 From: varac Date: Thu, 16 Apr 2015 06:31:35 +0000 Subject: use FAILURE_LOCKFILE for determining if deploy failure summary email needs to get send --- leap-platform-test | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/leap-platform-test b/leap-platform-test index bdeddc7..e5c2c27 100755 --- a/leap-platform-test +++ b/leap-platform-test @@ -21,7 +21,7 @@ OPTIONS -a|--all run command on all nodes -c|--config file specify config file -h|--help show help - -l|--lock write a lock file if tests fail, and refuse to deploy if it exists + -l|--lock refuse to deploy if lockfile from previous failures exists -V|--versions show versions/git revision of leap_cli and leap_platoform in provider dir COMMANDS @@ -175,7 +175,7 @@ deploy() { # send an host-specific error mail on deploy failures if [ -s "$ERRLOG1" ] then - touch "$deploy_failure" + touch $FAILURE_LOCKFILE versions=$( versions ) subj="WARNING - \"leap deploy\" of platform $PLATFORM_BRANCH branch on \"$vm\" had errors !" echo "$( date ): $msg" | tee -a "$LOG1" "$LOG2" "$ERRLOG2" @@ -193,7 +193,6 @@ deploy() { echo "Sending this mail to $MAIL_TO:" sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}" fi - touch $FAILURE_LOCKFILE else echo "Deploy to $vm on $( date ) went fine."| tee -a "$LOG1" "$LOG2" rm "$ERRLOG1" @@ -218,7 +217,7 @@ log_start() { deploy_failure_email() { # only send out a mail on success, because there are mails send out # for every hosts that has deploy errors anyway - if [ ! -e "$deploy_failure" -a -n "$MAIL_TO" ] + if [ ! -e "$FAILURE_LOCKFILE" -a -n "$MAIL_TO" ] then versions=$( versions ) subj="OK - \"leap deploy\" of platform $PLATFORM_BRANCH branch went fine." @@ -407,12 +406,9 @@ run_tests () { if [ "$test_failure" -ne 0 ] then echo 'WARNING - "leap test" failed !' | tee -a "$TEST_LOG1" "$TEST_LOG2" - if $lock ; then - touch $FAILURE_LOCKFILE - fi + touch $FAILURE_LOCKFILE else echo 'OK - "leap test" is all green !' | tee -a "$TEST_LOG1" "$TEST_LOG2" - rm -f $FAILURE_LOCKFILE fi return "$test_failure" @@ -489,9 +485,6 @@ print_versions=false # default in lib/leap_cli/leapfile.rb IP_PREFIX='10.5.5' -deploy_failure="/tmp/deploy_failure" -[ -e $deploy_failure ] && rm $deploy_failure - if ! options=$(getopt -o avVlc:h -l all,lock,verbose,versions,config:,help -- "$@") then # something went wrong, getopt will put out an error message for us -- cgit v1.2.3