summaryrefslogtreecommitdiff
path: root/leap-deploy-node.sh
diff options
context:
space:
mode:
Diffstat (limited to 'leap-deploy-node.sh')
-rwxr-xr-xleap-deploy-node.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/leap-deploy-node.sh b/leap-deploy-node.sh
new file mode 100755
index 0000000..6051604
--- /dev/null
+++ b/leap-deploy-node.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+. /etc/leap/platform-test.cfg
+
+vm=$1
+
+LOG="$LOGDIR/deploy-$vm.log"
+ERRLOG="$LOGDIR/deploy-$vm-`date +"%F-%H%M%S"`-error.log"
+
+cd $PROVIDERDIR
+
+
+# remove colors until #1751 is fixed
+RMCOLORS='s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g'
+
+# 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| - rsync| - hiera| - cd /root/| - rolling backexecuting'
+FILTER_PUPPET='] notice: | - Puppet apply complete.|] warning: Dynamic lookup|] warning: Scope\(Class'
+FILTER_ALL="($FILTER_CLI|$FILTER_PUPPET)"
+
+
+echo "Deploying \"$vm\" on `date`"|tee -a $LOG
+
+leap $OPTS -v 2 deploy $vm 2>&1 | sed -r "$RMCOLORS" | tee -a $LOG | egrep -v "$FILTER_ALL" > $ERRLOG
+
+
+if [ $? -eq 0 ]
+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
+ echo "Sending this mail:"
+ echo
+ cat $ERRLOG
+
+ printf "$msg" | sendmail -t
+
+else
+ echo "Deploy to $vm on `date` went fine."| tee -a $LOG
+fi
+
+echo