summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2015-10-31 22:10:30 +0000
committervarac <varacanero@zeromail.org>2015-10-31 22:10:30 +0000
commitce1c23d95c2b4f72ff21dfad14b7f17915cda7a7 (patch)
tree6bfd248a64350180866aea292bb8dcab933f7fff
parent1667bd44f011eb7f7da2666528f28c3f728f5fbc (diff)
Print all errors after deploy run, add summary
-rwxr-xr-xleap-platform-test39
1 files changed, 35 insertions, 4 deletions
diff --git a/leap-platform-test b/leap-platform-test
index 6b6e806..05fd741 100755
--- a/leap-platform-test
+++ b/leap-platform-test
@@ -4,9 +4,10 @@
# in case the script gets canceled, use a trap to finally remove the
# lockfile that indicates a running process
-
trap "cleanup" INT TERM
+shopt -s expand_aliases
+alias strip_colors='sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"'
usage()
{
@@ -177,10 +178,10 @@ 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" > /dev/null
+ $LEAP_CMD $OPTS -v 2 deploy "$vm" 2>&1 | tee -a "$LOG1" "$LOG2" "$LOG_GLOBAL"
+ cat $LOG2 | strip_colors | egrep -v "$FILTER_ALL" | tee -a "$ERRLOG1" "$ERRLOG2" "$ERRLOG_GLOBAL" > /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
+ $LEAP_CMD $OPTS -v 2 deploy "$vm" 2>&1 | tee -a "$LOG1" "$LOG2" "$LOG_GLOBAL" | strip_colors | egrep -v "$FILTER_ALL" | tee -a "$ERRLOG1" "$ERRLOG2" "$ERRLOG_GLOBAL" > /dev/null
fi
# send an host-specific error mail on deploy failures
@@ -306,9 +307,11 @@ init_deploy() {
if [ -e "$FAILURE_LOCKFILE" ]
then
+ print_global_errorlog
deploy_failure_email
returncode=1
fi
+ summary
return $returncode
}
@@ -357,9 +360,11 @@ reset_deploy() {
if [ -e "$FAILURE_LOCKFILE" ]
then
+ print_global_errorlog
deploy_failure_email
returncode=1
fi
+ summary
return $returncode
}
@@ -405,12 +410,35 @@ destroy_deploy() {
if [ -e "$FAILURE_LOCKFILE" ]
then
+ print_global_errorlog
deploy_failure_email
returncode=1
fi
+ summary
return $returncode
}
+print_global_errorlog () {
+ COLOR="\033[31m"
+ PLAIN="\033[0m"
+ echo -e "${COLOR}"
+ echo -e "\n==================================================================\n"
+ echo "Errors during deploy:"
+
+ cat $ERRLOG_GLOBAL | strip_colors
+
+ echo -e "\n==================================================================\n\n"
+
+ echo -e "${PLAIN}"
+
+}
+
+summary () {
+ echo "Complete deploy log: $LOG_GLOBAL"
+ [ -f $ERRLOG_GLOBAL ] && echo "Error deploy log: $ERRLOG_GLOBAL"
+ versions
+}
+
ssh_up () {
nc -w 4 "$1" 22 > /dev/null
return $?
@@ -509,6 +537,7 @@ wait_for_node() {
# http://docs.vagrantup.com/v2/providers/default.html
export VAGRANT_DEFAULT_PROVIDER="libvirt"
+
config=""
all=false
verbose=false
@@ -560,6 +589,8 @@ source "$config"
source /etc/leap/platform-test-common.cfg
date=$( date +"%F-%H%M%S" )
+LOG_GLOBAL="$LOGDIR/deploy-$date.log"
+ERRLOG_GLOBAL="$LOGDIR/deploy-$date-error.log"
TEST_LOG1="$LOGDIR/test.log"
TEST_LOG2="$LOGDIR/test-$date.log"