From e4119e73bc71c690dcb20b9adcf3182bab4cd7e9 Mon Sep 17 00:00:00 2001 From: varac Date: Wed, 3 Sep 2014 21:30:57 +0200 Subject: finished linting --- leap-platform-test | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/leap-platform-test b/leap-platform-test index e003ef8..96f6d78 100755 --- a/leap-platform-test +++ b/leap-platform-test @@ -1,4 +1,7 @@ #!/bin/bash +# +# - attach logs with sendemail + usage() { @@ -121,10 +124,10 @@ deploy() { then touch "$deploy_failure" versions=$( versions ) - msg="From: $MAIL_FROM\nTo: $MAIL_TO\nSubject: WARNING - \"leap deploy\" of platform $PLATFORM_BRANCH branch on \"$vm\" had errors !\n\n" + subj="WARNING - \"leap deploy\" of platform $PLATFORM_BRANCH branch on \"$vm\" had errors !" echo "$( date ): $msg" | tee -a "$LOG1" "$LOG2" "$ERRLOG2" echo - msg="${msg} Output of error log below:\n\n$( cat "$ERRLOG1" ) \n\n" + msg="Output of error log below:\n\n$( cat "$ERRLOG1" ) \n\n" msg="${msg}-------------------------------------------------------------------\n\n" msg="${msg}error log: ${ERRLOG1}\n" msg="${msg}comlete log: ${LOG2}\n\n" @@ -135,7 +138,7 @@ deploy() { if [ "$MAIL_TO" != '' ]; then echo "Sending this mail to $MAIL_TO:" - printf "$msg" | /usr/sbin/sendmail -t + sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}" fi else @@ -162,7 +165,7 @@ log_start() { reset_deploy() { - local nodes=$@ + local nodes="$*" update_platform update_leap_cli @@ -188,11 +191,11 @@ reset_deploy() { if [ ! -e "$deploy_failure" -a -n "$MAIL_TO" ] then versions=$( versions ) - msg="From: $MAIL_FROM\nTo: $MAIL_TO\nSubject: OK - \"leap deploy\" of platform $PLATFORM_BRANCH branch went fine.\n\n" - msg="${msg}Tested on $( date ) on these nodes: \"$nodes\"\nwith following versions/git commit IDs: \n\n$versions" + subj="OK - \"leap deploy\" of platform $PLATFORM_BRANCH branch went fine." + msg="Tested on $( date ) on these nodes: \"$nodes\"\nwith following versions/git commit IDs: \n\n$versions" echo "Sending deploy success mail to $MAIL_TO" - printf "$msg" | /usr/sbin/sendmail -t + sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}" fi run_tests @@ -231,7 +234,7 @@ run_tests () { $LEAP_CMD "$OPTS" test 2>&1 | egrep -v "$TEST_FILTER" | tee -a "$TEST_LOG1" "$TEST_LOG2" test_failure=${PIPESTATUS[0]} - if [ $test_failure -ne 0 ] + if [ "$test_failure" -ne 0 ] then echo 'WARNING - "leap test" failed !' | tee -a "$TEST_LOG1" "$TEST_LOG2" else @@ -254,13 +257,6 @@ update_platform () { } versions () { - cd "$PLATFORMDIR" - platform_head=$( git rev-parse HEAD ) - platform_commit=$( git show | head -6 ) - - cd "$LEAP_SRC" - cli_head=$( git rev-parse HEAD ) - cli_commit=$( git show "$cli_head" | head -6 ) cd "$PROVIDERDIR" [ -d .git ] && provider_head=$( git rev-parse HEAD ) @@ -272,15 +268,12 @@ versions () { echo "Provider ($PROVIDERDIR): $provider_head" echo - #echo leap cli: $cli_head $LEAP_CMD -v 2 list | grep ' = leap command v' - echo "$cli_commit" echo echo #echo "leap_platform:" $LEAP_CMD -v 2 list | grep ' = leap platform v' - echo "$platform_commit" echo echo } @@ -327,7 +320,6 @@ do -h|--help) usage; exit 1;; -c|--config) config=$2; shift ;; -a|--all) all=true;; - -v|--verbose) VERBOSE=1 ;; -V|--versions) print_versions=true;; (--) shift; break;; (-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;; @@ -339,7 +331,7 @@ done cmd=$1 shift -nodelist=$@ +nodelist="$*" #echo "config: $config" #echo "cmd: $cmd" -- cgit v1.2.3