diff options
author | Leap Admins <sysdev@leap.se> | 2013-05-05 09:30:40 +0000 |
---|---|---|
committer | Leap Admins <sysdev@leap.se> | 2013-05-05 09:31:10 +0000 |
commit | ab5c8d626774eefba6a8ea969e8db7e1ec025315 (patch) | |
tree | 3d278947852e8c6cdf74e83cfaa005089050e763 | |
parent | 7cc36ac3dfb98bea05e5c32d3ef1ae5ab678311a (diff) |
integrated leap-bootstrap-node.sh into leap-platform-test
-rwxr-xr-x | leap-bootstrap-all.sh | 10 | ||||
-rwxr-xr-x | leap-bootstrap-node.sh | 17 | ||||
-rwxr-xr-x | leap-platform-test | 76 |
3 files changed, 47 insertions, 56 deletions
diff --git a/leap-bootstrap-all.sh b/leap-bootstrap-all.sh deleted file mode 100755 index a42df27..0000000 --- a/leap-bootstrap-all.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -. /etc/leap/platform-test.cfg - - -for i in $NODES -do - $PLATFORM_TEST_BIN/leap-bootstrap-node.sh $i -done - diff --git a/leap-bootstrap-node.sh b/leap-bootstrap-node.sh deleted file mode 100755 index c5fd05b..0000000 --- a/leap-bootstrap-node.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -x - -. /etc/leap/platform-test.cfg - -PROVIDERDIR=$ROOTDIR/$PROVIDER - -cd $PROVIDERDIR - -vm=$1 - -leap $OPTS local start $vm -sleep 20 -leap $OPTS node init $vm -# set hostname + do dist-upgrade -leap $OPTS deploy $vm --tags site_apt::dist_upgrade,site_config::hosts -leap $OPTS local save $vm - diff --git a/leap-platform-test b/leap-platform-test index bee3748..cbae303 100755 --- a/leap-platform-test +++ b/leap-platform-test @@ -15,9 +15,14 @@ OPTIONS -h|--help show help COMMANDS - deploy <node> deploy node - reset_deploy <node> reset and deploy node - + bootstrap <node(s)> bootstrap node(s): + - leap local start + - leap node int + - sets up hostname and runs apt-get dist-upgrade + - leap local save + deploy <node(s)> deploy node(s) + reset_deploy <node(s)> reset and deploy node(s) + EOF } @@ -37,6 +42,19 @@ add_nodes() { done } + +bootstrap_nodes() { + for vm in $@ + do + leap $OPTS local start $vm + sleep $SLEEP + leap $OPTS node init $vm + # set hostname + do dist-upgrade + leap $OPTS deploy $vm --tags site_apt::dist_upgrade,site_config::hosts + leap $OPTS local save $vm + done +} + compile () { leap $OPTS clean leap $OPTS compile @@ -44,7 +62,6 @@ compile () { deploy() { - vm=$1 LOG="$LOGDIR/deploy-$vm.log" ERRLOG="$LOGDIR/deploy-$vm-`date +"%F-%H%M%S"`-error.log" @@ -57,27 +74,28 @@ deploy() { 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 + for vm in $@ + do + 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 - - else - echo "Deploy to $vm on `date` went fine."| tee -a $LOG - fi + done } reset_deploy() { @@ -132,11 +150,10 @@ cmd=$1 shift nodelist=$@ -echo "config: $config" -echo "cmd: $cmd" -echo "nodelist: $nodelist" -echo "all: $all" -#echo "remaining: $@" +#echo "config: $config" +#echo "cmd: $cmd" +#echo "nodelist: $nodelist" +#echo "all: $all" if [ -z $config ] then @@ -158,6 +175,7 @@ echo echo "Starting $0 on `date`" case $cmd in + bootstrap) bootstrap_nodes "$nodes";; deploy) deploy "$nodes";; reset_deploy) reset_deploy "$nodes";; esac |