blob: 039f635e2146343d0b11534a42f0f0161afa3bbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/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| - cd .*; rsync -a| - hiera| = created hiera/| - cd /root/| - rolling backexecuting| - files/ca/client_ca.crt|\[bin,puppet\] ->'
FILTER_PUPPET='] notice: |] No change to hostname|] 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
cat $ERRLOG
if [ "$MAIL_TO" != '' ]; then
echo "Sending this mail to $MAIL_TO:"
printf "$msg" | sendmail -t
fi
else
echo "Deploy to $vm on `date` went fine."| tee -a $LOG
fi
echo
|