exception handling during install, added pushover notification

This commit is contained in:
mischa 2020-10-04 14:08:31 +02:00
parent f0f264d492
commit f98ed45f36
2 changed files with 20 additions and 4 deletions

View File

@ -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
}
}

View File

@ -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