summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormischa <mischa@rx.high5.nl>2020-10-04 14:08:31 +0200
committermischa <mischa@rx.high5.nl>2020-10-04 14:08:31 +0200
commitf98ed45f36f87109f25340f99ba443d528ea5709 (patch)
treeba17b3c6e41e5bba5ebf9fd3a9eb35a04ec16214
parentf0f264d492c244d60ea149703fc1e523fdbab908 (diff)
exception handling during install, added pushover notification
-rwxr-xr-xauto-deploy.exp14
-rwxr-xr-xlaunch.sh10
2 files changed, 20 insertions, 4 deletions
diff --git a/auto-deploy.exp b/auto-deploy.exp
index 28f610b..b422308 100755
--- a/auto-deploy.exp
+++ b/auto-deploy.exp
@@ -1,6 +1,6 @@
#!/usr/local/bin/expect -f
#
-# Copyright (c) 2019 Mischa Peters <mischa @ openbsd.amsterdam>
+# Copyright (c) 2019-2020 Mischa Peters <mischa @ openbsd.amsterdam>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -20,4 +20,14 @@ spawn vmctl start -c $vmid
expect "(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? "
sleep 3
send "a\r"
-expect "(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? "
+expect {
+ -re "Response file location?.*" {
+ exit 1
+ }
+ "Performing non-interactive install..." {
+ exp_continue
+ }
+ "(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? " {
+ exit 0
+ }
+}
diff --git a/launch.sh b/launch.sh
index a696de5..b56f3ca 100755
--- a/launch.sh
+++ b/launch.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2019 Mischa Peters <mischa @ openbsd.amsterdam>
+# Copyright (c) 2019-2020 Mischa Peters <mischa @ openbsd.amsterdam>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -36,7 +36,12 @@ vmctl reload
sleep 10
auto-deploy.exp ${1}
-if [ $? ]; then
+if [ $? != 0 ]; then
+ vmctl stop -f ${1}
+ rm -rf /var/vmm/${1}.qcow2
+ pushover.pl -m "$(hostname -s) ${1} failed deploy" -p 1
+ exit 1
+else
vmctl stop -f ${1}
fi
@@ -50,4 +55,5 @@ if [ $? ]; then
echo
echo "SUCCES! - deployed ${1}"
notify.pl deployed ${1}
+ pushover.pl -m "$(hostname -s) ${1} deployed"
fi