add some more set flags

This commit is contained in:
ronivay
2020-05-31 13:00:03 +03:00
parent 8b0c3722c0
commit f38f169146

View File

@@ -98,6 +98,8 @@ function printinfo {
function ErrorHandling { function ErrorHandling {
set -eu
echo echo
printfail "Something went wrong, exiting. Check $LOGFILE for more details and use rollback feature if needed" printfail "Something went wrong, exiting. Check $LOGFILE for more details and use rollback feature if needed"
@@ -111,7 +113,7 @@ function ErrorHandling {
function InstallDependenciesCentOS { function InstallDependenciesCentOS {
set -e set -euo pipefail
trap ErrorHandling ERR INT trap ErrorHandling ERR INT
@@ -198,7 +200,7 @@ function InstallDependenciesCentOS {
function InstallDependenciesDebian { function InstallDependenciesDebian {
set -e set -euo pipefail
trap ErrorHandling ERR INT trap ErrorHandling ERR INT
@@ -338,7 +340,7 @@ function UpdateNodeYarn {
function InstallXOPlugins { function InstallXOPlugins {
set -e set -euo pipefail
trap ErrorHandling ERR INT trap ErrorHandling ERR INT
@@ -373,7 +375,7 @@ function InstallXOPlugins {
function InstallXO { function InstallXO {
set -e set -euo pipefail
trap ErrorHandling ERR INT trap ErrorHandling ERR INT
@@ -641,7 +643,7 @@ function InstallXO {
/bin/systemctl start xo-server >>$LOGFILE 2>&1 /bin/systemctl start xo-server >>$LOGFILE 2>&1
# no need to exit/trap on errors anymore # no need to exit/trap on errors anymore
set +e set +eo pipefail
trap - ERR INT trap - ERR INT
timeout 60 bash <<-"EOF" timeout 60 bash <<-"EOF"
@@ -674,6 +676,8 @@ function UpdateXO {
InstallXO InstallXO
set -euo pipefail
if [[ "$PRESERVE" != "0" ]]; then if [[ "$PRESERVE" != "0" ]]; then
# remove old builds. leave as many as defined in PRESERVE variable # remove old builds. leave as many as defined in PRESERVE variable
@@ -723,6 +727,8 @@ function HandleArgs {
function RollBackInstallation { function RollBackInstallation {
set -euo pipefail
INSTALLATIONS=($(find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra-*" 2>/dev/null)) INSTALLATIONS=($(find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra-*" 2>/dev/null))
if [[ $(echo ${#INSTALLATIONS[@]}) -le 1 ]]; then if [[ $(echo ${#INSTALLATIONS[@]}) -le 1 ]]; then