[refactor] Edit logic around setup failure/completion

* Always run `install_cleanup` and `so-allow`
* Change if statement to check whether `$success != 0` or if `$SO_ERROR` was set
* Set `$IP` only for `so-allow` instead of exporting it
This commit is contained in:
William Wernert
2020-07-07 13:12:46 -04:00
parent 1d47cec928
commit 3815f7e58e

View File

@@ -615,24 +615,17 @@ fi
} | progress
success=$(tail -10 $setup_log | grep Failed | awk '{ print $2}')
if [[ "$success" = 0 ]]; then
whiptail_setup_complete
if [[ -n $ALLOW_ROLE && -n $ALLOW_CIDR ]]; then
export IP=$ALLOW_CIDR
so-allow -$ALLOW_ROLE >> $setup_log 2>&1
fi
if [[ $THEHIVE == 1 ]]; then
check_hive_init
fi
else
whiptail_setup_failed
if [[ -n $ALLOW_ROLE && -n $ALLOW_CIDR ]]; then
IP=$ALLOW_CIDR so-allow -$ALLOW_ROLE >> $setup_log 2>&1
fi
if [[ -z $SKIP_REBOOT ]]; then
shutdown -r now
if [[ $success != 0 || -z $SO_ERROR ]]; then whiptail_setup_failed
else
whiptail_setup_complete
if [[ $THEHIVE == 1 ]]; then check_hive_init; fi
fi
install_cleanup >> $setup_log 2>&1
if [[ -z $SKIP_REBOOT ]]; then shutdown -r now; else exit; fi