diff options
author | mischa <mischa@rx.high5.nl> | 2020-10-04 14:08:31 +0200 |
---|---|---|
committer | mischa <mischa@rx.high5.nl> | 2020-10-04 14:08:31 +0200 |
commit | f98ed45f36f87109f25340f99ba443d528ea5709 (patch) | |
tree | ba17b3c6e41e5bba5ebf9fd3a9eb35a04ec16214 | |
parent | f0f264d492c244d60ea149703fc1e523fdbab908 (diff) |
exception handling during install, added pushover notification
-rwxr-xr-x | auto-deploy.exp | 14 | ||||
-rwxr-xr-x | launch.sh | 10 |
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 + } +} @@ -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 |