Improve error handling

This commit is contained in:
ronivay
2018-07-28 16:49:13 +03:00
parent a73c65cea4
commit 6fb1a19f0c

View File

@@ -45,10 +45,22 @@ function CheckUser {
}
function ErrorHandling {
echo "Something went wrong, exiting. Check $LOGFILE for more details and use rollback feature if needed"
if [[ -d $INSTALLDIR/xo-builds/xen-orchestra-$TIME ]]; then
echo "Removing $INSTALLDIR/xo-builds/xen-orchestra-$TIME because of failed installation."
rm -rf $INSTALLDIR/xo-builds/xen-orchestra-$TIME
fi
}
function InstallDependenciesCentOS {
set -e
trap ErrorHandling ERR INT
# Install necessary dependencies for XO build
# only run automated node install if package not found
@@ -92,6 +104,8 @@ function InstallDependenciesDebian {
set -e
trap ErrorHandling ERR INT
# Install necessary dependencies for XO build
echo
@@ -165,6 +179,10 @@ function UpdateNodeYarn {
function InstallXOPlugins {
set -e
trap ErrorHandling ERR INT
if [[ "$PLUGINS" ]] && [[ ! -z "$PLUGINS" ]]; then
echo
@@ -192,6 +210,8 @@ function InstallXO {
set -e
trap ErrorHandling ERR INT
TIME=$(date +%Y%d%m%H%M)
# Create user if doesn't exist (if defined)
@@ -417,7 +437,7 @@ function RollBackInstallation {
esac
done
} 2>$LOGFILE
}
function CheckOS {