diff options
author | varac <varacanero@zeromail.org> | 2015-10-22 20:47:09 +0000 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2015-10-22 20:47:09 +0000 |
commit | 1667bd44f011eb7f7da2666528f28c3f728f5fbc (patch) | |
tree | 8b83395f184af3559dc5316d47c5dd53b354f0fe | |
parent | aad647376df2f2c2b7cd8b452d534d200a46d9f4 (diff) |
finally fixed exit status, don't duplicate errors on verbose mode
-rwxr-xr-x | leap-platform-test | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/leap-platform-test b/leap-platform-test index eb5a79d..6b6e806 100755 --- a/leap-platform-test +++ b/leap-platform-test @@ -101,17 +101,21 @@ check_for_running_instances() { exit 1 fi - if [[ $lock && -f $FAILURE_LOCKFILE ]] + if [[ -f $FAILURE_LOCKFILE ]] then - subj="WARNING: CI failure lockfile found for branch ${PLATFORM_BRANCH} - previous deploy tests failed !" - msg="CI lock found, and --lock in use. This means that leap test failed on the previous run.\n Please investigate and then remove $FAILURE_LOCKFILE\n\n" - if [ "$MAIL_TO" != '' ]; then - echo "$subj Sending mail to $MAIL_TO:" - sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}" - fi - exit 1 + if [[ $lock ]] + then + subj="WARNING: CI failure lockfile found for branch ${PLATFORM_BRANCH} - previous deploy tests failed !" + msg="CI lock found, and --lock in use. This means that leap test failed on the previous run.\n Please investigate and then remove $FAILURE_LOCKFILE\n\n" + if [ "$MAIL_TO" != '' ]; then + echo "$subj Sending mail to $MAIL_TO:" + sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}" + fi + exit 1 + else + rm $FAILURE_LOCKFILE + fi fi - } create_provider() { @@ -174,7 +178,7 @@ deploy() { if $verbose then $LEAP_CMD $OPTS -v 2 deploy "$vm" 2>&1 | tee -a "$LOG1" "$LOG2" - egrep -v "$FILTER_ALL" $LOG2 | tee -a "$ERRLOG1" "$ERRLOG2" + egrep -v "$FILTER_ALL" $LOG2 | tee -a "$ERRLOG1" "$ERRLOG2" > /dev/null else $LEAP_CMD $OPTS -v 2 deploy "$vm" 2>&1 | tee -a "$LOG1" "$LOG2" | egrep -v "$FILTER_ALL" | tee -a "$ERRLOG1" "$ERRLOG2" > /dev/null fi @@ -183,7 +187,6 @@ deploy() { if [ -s "$ERRLOG1" ] then touch $FAILURE_LOCKFILE - global_deploy_failure=true returncode=1 versions=$( versions ) subj="WARNING - \"leap deploy\" of platform $PLATFORM_BRANCH branch on \"$vm\" had errors !" @@ -301,7 +304,7 @@ init_deploy() { echo "Waiting until last deploy process has finished..." wait - if $global_deploy_failure + if [ -e "$FAILURE_LOCKFILE" ] then deploy_failure_email returncode=1 @@ -352,7 +355,7 @@ reset_deploy() { echo "Waiting until last deploy process has finished..." wait - if $global_deploy_failure + if [ -e "$FAILURE_LOCKFILE" ] then deploy_failure_email returncode=1 @@ -400,7 +403,7 @@ destroy_deploy() { echo "Waiting until last deploy process has finished..." wait - if $global_deploy_failure + if [ -e "$FAILURE_LOCKFILE" ] then deploy_failure_email returncode=1 @@ -426,7 +429,7 @@ run_tests () { #$LEAP_CMD $OPTS -v 2 deploy "$vm" 2>&1 | tee -a "$LOG1" "$LOG2" $LEAP_CMD $OPTS test --continue 2>&1 | tee -a "$TEST_LOG1" "$TEST_LOG2" test_failure=${PIPESTATUS[0]} - egrep -v "$TEST_FILTER" $TEST_LOG2 | tee -a "$TEST_LOG1" "$TEST_LOG2" + egrep -v "$TEST_FILTER" $TEST_LOG2 | tee -a "$TEST_LOG1" "$TEST_LOG2" > /dev/null else $LEAP_CMD $OPTS test --continue 2>&1 | egrep -v "$TEST_FILTER" | tee -a "$TEST_LOG1" "$TEST_LOG2" test_failure=${PIPESTATUS[0]} @@ -512,7 +515,6 @@ verbose=false print_versions=false # default in lib/leap_cli/leapfile.rb IP_PREFIX='10.5.5' -global_deploy_failure=false if ! options=$(getopt -o avVlc:h -l all,lock,verbose,versions,config:,help -- "$@") |