summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@lab.bitrigger.de>2013-02-15 11:16:51 +0100
committerroot <root@lab.bitrigger.de>2013-02-15 11:16:51 +0100
commite580321ca55c77435c95035354aec833b7abc665 (patch)
treed9b115235407908bd9d5305f7a2143a6aebccef8
parentc782c2c8d7408690d614453fac41b5a620610fec (diff)
mostly working now
-rwxr-xr-xdebug/leap-bootstrap-ca.sh2
-rwxr-xr-xleap-add-nodes.sh20
-rwxr-xr-xleap-bootstrap-provider.sh24
-rwxr-xr-xleap-deploy-node.sh42
-rwxr-xr-xleap-reset-deploy-all.sh21
5 files changed, 104 insertions, 5 deletions
diff --git a/debug/leap-bootstrap-ca.sh b/debug/leap-bootstrap-ca.sh
index 6fd6232..ef96534 100755
--- a/debug/leap-bootstrap-ca.sh
+++ b/debug/leap-bootstrap-ca.sh
@@ -6,7 +6,7 @@ rm -rf $ROOT/example
mkdir -p $ROOT/example
cd $ROOT/example
-leap new .
+leap --yes new .
cd $ROOT/leap_platform
git checkout develop
git submodule update --init
diff --git a/leap-add-nodes.sh b/leap-add-nodes.sh
new file mode 100755
index 0000000..5e4d18a
--- /dev/null
+++ b/leap-add-nodes.sh
@@ -0,0 +1,20 @@
+#!/bin/sh -x
+
+. /etc/leap/platform-test.cfg
+
+cd $ROOTDIR/$PROVIDER
+
+for i in $SERVICES
+do
+ case $i in
+ openvpn)
+ config='openvpn.gateway_address:10.5.5.99'
+ ;;
+ *)
+ config=''
+ ;;
+ esac
+
+ leap node add --local $i $config services:$i
+done
+
diff --git a/leap-bootstrap-provider.sh b/leap-bootstrap-provider.sh
index c2fb3b9..912a705 100755
--- a/leap-bootstrap-provider.sh
+++ b/leap-bootstrap-provider.sh
@@ -4,8 +4,24 @@
cd $ROOTDIR/$PROVIDER
-for i in $SERVICES
-do
- leap node add --local $i services:$i
-done
+if [ -e $ROOTDIR/$PROVIDER ]
+then
+ echo $ROOTDIR/$PROVIDER exists - exiting
+ exit 1
+fi
+mkdir $ROOTDIR/$PROVIDER
+cd $ROOTDIR/$PROVIDER
+leap new .
+cd $ROOTDIR/leap_platform
+git checkout develop
+git submodule update --init
+cd $ROOTDIR/$PROVIDER
+
+
+leap add-user --self
+leap cert ca && leap cert csr
+leap cert dh
+
+$PLATFORM_TEST_BIN/leap-add-nodes.sh
+$PLATFORM_TEST_BIN/leap-bootstrap-all.sh
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
diff --git a/leap-reset-deploy-all.sh b/leap-reset-deploy-all.sh
new file mode 100755
index 0000000..d89c9fc
--- /dev/null
+++ b/leap-reset-deploy-all.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+. /etc/leap/platform-test.cfg
+
+
+cd $ROOTDIR/$PROVIDER
+
+echo
+echo "Starting $0 on `date`"
+
+leap compile
+leap local reset
+
+for i in $SERVICES
+do
+ $PLATFORM_TEST_BIN/leap-deploy-node.sh $i
+done
+
+echo
+echo "Finished $0 on `date`"
+