From: Holger Levsen Date: Thu, 8 Nov 2012 13:10:58 +0000 (+0100) Subject: add comments and use more variables X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=64d004df839c94afd69ed7facb0d55fdd6944dda;p=profitbricks%2Fjenkins-build-scripts.git add comments and use more variables --- diff --git a/liveboot_testdeploy.sh b/liveboot_testdeploy.sh index 78a2948..f0a4fa1 100755 --- a/liveboot_testdeploy.sh +++ b/liveboot_testdeploy.sh @@ -7,53 +7,74 @@ set -e set -x export +TESTSERVER=pserver2 +TESTSERVER_MGMT_IP=192.168.178.49 +TESTSERVER_MGMT_PASSWD_FILE=/etc/jenkins/pserver2.ipmi + +MAILTO=liveboot-announce@profitbricks.com + +# +# check if we have a LIVEBOOT_ID +# if [ "$LIVEBOOT_ID" != "" ] ; then echo "Ok, got LIVEBOOT_ID=$LIVEBOOT_ID" else echo "Fail, no LIVEBOOT_ID set." exit 1 fi - +# +# check if there is an image for it +# if [ -d /srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/ ] ; then SOURCE_DIR=$(ls -d /srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/) else - echo "Fail, /srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/ does not exist." + figlet "Failure:" + echo "/srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/ does not exist." exit 1 fi -TESTSERVER=pserver2 - +# FIXME +# +# reconfigure PXE to make $TESTSERVER boot this image +# #ssh liveboot@riserver echo Ok -ping -c 1 $TESTSERVER -cat /etc/jenkins/pserver2.ipmi | ipmitool -H 192.168.178.49 -U ADMIN -a chassis power reset +# +# reboot TESTSERVER +# +cat $TESTSERVER_MGMT_PASSWD_FILE | ipmitool -H $TESTSERVER_MGMT_IP -U ADMIN -a chassis power reset -sleep 2 -ping -c 1 $TESTSERVER || true - -for i in $(seq 1 10) ; do - sleep 60 +# +# check for 10min whether it's up again +# +for i in $(seq 1 30) ; do + sleep 20 if $(ping -c 1 $TESTSERVER >/dev/null) ; then + figlet "Ok, pings again..." break fi done - if ! $(ping -c 1 $TESTSERVER >/dev/null) ; then figlet "Warning" echo "$TESTSERVER still down, please investigate." exit 1 fi +# +# send announce mail +# MAIL=$SOURCE_DIR/mail.txt -MAILTO=liveboot-announce@profitbricks.com -if [ ! -e $MAIL ] +if [ ! -e $MAIL ] ; then figlet "Warning" - echo "$TESTSERVER still down, please investigate." + echo "$MAIL does not exist, something wrong with liveboot-web?" exit 1 fi - cat $MAIL | mail $MAILTO && echo "Mail to $MAILTO send." cat $MAIL | mail holger@layer-acht.org + +# +# finish +# figlet Ok echo "$TESTSERVER pings again, so we assume it's up." echo "Please continue manual testing of $(basedir $SOURCE_DIR)"