summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeap Admins <sysdev@leap.se>2013-05-12 20:36:03 +0000
committerLeap Admins <sysdev@leap.se>2013-05-12 20:36:03 +0000
commitfcf7ff26f3f9edf70590829983f86c5649bec3ed (patch)
treef69306849dddbd21b259aef37587eb1014ca4c7b
parent49ef8fcaecb12d673b2ae6156333b7272b9b1dda (diff)
improve error logging
-rwxr-xr-xleap-platform-test28
1 files changed, 16 insertions, 12 deletions
diff --git a/leap-platform-test b/leap-platform-test
index 9162f46..dd5c909 100755
--- a/leap-platform-test
+++ b/leap-platform-test
@@ -97,25 +97,28 @@ deploy() {
# we need to deploy with verbose level 2, and filter out unwanted stuff
# until puppet errors show up in verbose level 0 +1 (#1750)
- FILTER_CLI='= read|= loading|= no change| - executing| = executing| = applying| = ran git| = checking| = synching| = skipping file_path| - cd .*; rsync -a| - hiera| = created hiera/| - cd /root/| - rolling backexecuting| - files/ca/client_ca.crt|\[bin,puppet\] ->'
+ FILTER_CLI='= read|= loading|= no change| - executing| = executing| = applying| = ran git| = checking| = synching| = skipping file_path| - cd .*; rsync -a| - hiera| = created hiera/| - cd /root/| - rolling backexecuting| - files/ca/client_ca.crt|\[bin,puppet\] ->|] Hostname updated.'
FILTER_PUPPET='] notice: |] No change to hostname|] Puppet apply complete|] warning: Dynamic lookup|] warning: Scope\(Class'
FILTER_ALL="($FILTER_CLI|$FILTER_PUPPET)"
for vm in $@
do
[ -e $LOGDIR ] || mkdir -p $LOGDIR
- LOG="$LOGDIR/deploy-$vm.log"
- ERRLOG="$LOGDIR/deploy-$vm-`date +"%F-%H%M%S"`-error.log"
- echo "Deploying \"$vm\" on `date`"|tee -a $LOG
+ date=`date +"%F-%H%M%S"`
+ LOG1="$LOGDIR/deploy-$vm.log"
+ LOG2="$LOGDIR/deploy-$vm-$date.log"
+ ERRLOG1="$LOGDIR/deploy-$vm-$date-error.log"
+ ERRLOG2="$LOGDIR/deploy-error.log"
+ echo "Deploying \"$vm\" on `date`"|tee -a $LOG1 $LOG2
- leap $OPTS -v 2 deploy $vm 2>&1 | sed -r "$RMCOLORS" | tee -a $LOG | egrep -v "$FILTER_ALL" > $ERRLOG
+ leap $OPTS -v 2 deploy $vm 2>&1 | sed -r "$RMCOLORS" | tee -a $LOG1 $LOG2 | egrep -v "$FILTER_ALL" | tee -a $ERRLOG1 $ERRLOG2 > /dev/null
- if [ $? -eq 0 ]
+ if [ -s $ERRLOG1 ]
then
- msg="From: $MAIL_FROM\nTo: $MAIL_TO\nSubject: Deploy to \"$vm\" had errors !\n\n`cat $ERRLOG`"
- echo "Deploy to \"$vm\" on `date` had errors." | tee -a $LOG
+ msg="From: $MAIL_FROM\nTo: $MAIL_TO\nSubject: Deploy to \"$vm\" had errors !\n\n`cat $ERRLOG1`"
+ echo "Deploy to \"$vm\" on `date` had errors." | tee -a $LOG1 $LOG2 $ERRLOG2
echo
- cat $ERRLOG
+ cat $ERRLOG1
if [ "$MAIL_TO" != '' ]; then
echo "Sending this mail to $MAIL_TO:"
@@ -123,13 +126,14 @@ deploy() {
fi
else
- echo "Deploy to $vm on `date` went fine."| tee -a $LOG
+ echo "Deploy to $vm on `date` went fine."| tee -a $LOG1 $LOG2
+ rm $ERRLOG1
fi
done
}
get_ip () {
- grep ip_address $PROVIDERDIR/nodes/$1.json |cut -f 2 -d:|sed 's/"//g'
+ grep ip_address $PROVIDERDIR/nodes/$1.json |cut -f 2 -d:|sed 's/[",]//g'
}
reset_deploy() {
@@ -158,9 +162,9 @@ ip_pingable () {
}
wait_for_node() {
- echo "Waiting for VM to come up..."
ip=`get_ip $i`
online=0
+ echo "Waiting for VM $i (IP: $ip) to come up..."
while [ $online -eq 0 ]
do
ip_pingable $ip && online=1