summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2015-04-15 19:24:43 +0000
committervarac <varacanero@zeromail.org>2015-04-15 19:24:43 +0000
commit5714ce580b51c756ad794640585b9a243051877b (patch)
tree3d8afaff89a73f7ce1f374c01c0ae7889740e3fa
parent738ac60cd904fe00e7b6738191d6a116bd28aff9 (diff)
restructured the failure mails so they work correctly again
-rwxr-xr-xleap-platform-test56
1 files changed, 31 insertions, 25 deletions
diff --git a/leap-platform-test b/leap-platform-test
index fd1aa01..40b482d 100755
--- a/leap-platform-test
+++ b/leap-platform-test
@@ -161,6 +161,32 @@ deploy() {
echo "Deploying \"$vm\" on $( date )"|tee -a "$LOG1" "$LOG2"
$LEAP_CMD $OPTS -v 2 deploy "$vm" 2>&1 | ts | tee -a "$LOG1" "$LOG2" | egrep -v "$FILTER_ALL" | tee -a "$ERRLOG1" "$ERRLOG2" > /dev/null
+
+ # send an host-specific error mail on deploy failures
+ if [ -s "$ERRLOG1" ]
+ then
+ touch "$deploy_failure"
+ versions=$( versions )
+ subj="WARNING - \"leap deploy\" of platform $PLATFORM_BRANCH branch on \"$vm\" had errors !"
+ echo "$( date ): $msg" | tee -a "$LOG1" "$LOG2" "$ERRLOG2"
+ echo
+ 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"
+
+ msg="${msg}Tested on $( date ) on \"$vm\" with following versions/git commit IDs: \n\n$versions"
+
+ cat "$ERRLOG1"
+
+ if [ "$MAIL_TO" != '' ]; then
+ echo "Sending this mail to $MAIL_TO:"
+ sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}"
+ fi
+ else
+ echo "Deploy to $vm on $( date ) went fine."| tee -a "$LOG1" "$LOG2"
+ rm "$ERRLOG1"
+ fi
done
}
@@ -179,31 +205,11 @@ log_start() {
}
deploy_failure_email() {
- versions=$( versions )
- if [ -s "$ERRLOG1" ]
- then
- touch "$deploy_failure"
- subj="WARNING - \"leap deploy\" of platform $PLATFORM_BRANCH branch on \"$vm\" had errors !"
- echo "$( date ): $msg" | tee -a "$LOG1" "$LOG2" "$ERRLOG2"
- echo
- 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"
-
- msg="${msg}Tested on $( date ) on \"$vm\" with following versions/git commit IDs: \n\n$versions"
-
- cat "$ERRLOG1"
-
- if [ "$MAIL_TO" != '' ]; then
- echo "Sending this mail to $MAIL_TO:"
- sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}"
- fi
-
- elif [ ! -e "$deploy_failure" -a -n "$MAIL_TO" ]
+ # 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" ]
then
- echo "Deploy to $vm on $( date ) went fine."| tee -a "$LOG1" "$LOG2"
- rm "$ERRLOG1"
+ versions=$( 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"
@@ -272,7 +278,7 @@ init_deploy() {
wait
# send mail if deployment fails
- deploy_failure_email
+ deploy_failure_email
# run tests
run_tests