Improve error handling
This commit is contained in:
@@ -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 {
|
function InstallDependenciesCentOS {
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
trap ErrorHandling ERR INT
|
||||||
|
|
||||||
# Install necessary dependencies for XO build
|
# Install necessary dependencies for XO build
|
||||||
|
|
||||||
# only run automated node install if package not found
|
# only run automated node install if package not found
|
||||||
@@ -92,6 +104,8 @@ function InstallDependenciesDebian {
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
trap ErrorHandling ERR INT
|
||||||
|
|
||||||
# Install necessary dependencies for XO build
|
# Install necessary dependencies for XO build
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@@ -165,6 +179,10 @@ function UpdateNodeYarn {
|
|||||||
|
|
||||||
function InstallXOPlugins {
|
function InstallXOPlugins {
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
trap ErrorHandling ERR INT
|
||||||
|
|
||||||
if [[ "$PLUGINS" ]] && [[ ! -z "$PLUGINS" ]]; then
|
if [[ "$PLUGINS" ]] && [[ ! -z "$PLUGINS" ]]; then
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@@ -192,6 +210,8 @@ function InstallXO {
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
trap ErrorHandling ERR INT
|
||||||
|
|
||||||
TIME=$(date +%Y%d%m%H%M)
|
TIME=$(date +%Y%d%m%H%M)
|
||||||
|
|
||||||
# Create user if doesn't exist (if defined)
|
# Create user if doesn't exist (if defined)
|
||||||
@@ -381,7 +401,7 @@ function HandleArgs {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function RollBackInstallation {
|
function RollBackInstallation {
|
||||||
|
|
||||||
INSTALLATIONS=($(find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra-*"))
|
INSTALLATIONS=($(find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra-*"))
|
||||||
|
|
||||||
@@ -417,7 +437,7 @@ function RollBackInstallation {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
} 2>$LOGFILE
|
}
|
||||||
|
|
||||||
function CheckOS {
|
function CheckOS {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user