diff options
Diffstat (limited to 'leap-platform-test')
-rwxr-xr-x | leap-platform-test | 76 |
1 files changed, 47 insertions, 29 deletions
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 |