From df465a7f8609cbc3ed92b48a1a07374aed7a3583 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 18 Sep 2018 14:12:49 +0200 Subject: [PATCH] do not upgrade elastic script if some requirements are not found --- scripts/elastic-upgrade.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/elastic-upgrade.sh b/scripts/elastic-upgrade.sh index 97335c60b..76af95f51 100755 --- a/scripts/elastic-upgrade.sh +++ b/scripts/elastic-upgrade.sh @@ -10,6 +10,11 @@ config() { + if [ "$(whoami)" != "root" ] + then + echo "Please do not run this script as root, elevation will be prompted if needed." + exit 1 + fi echo "detecting curl..." if ! command -v curl then @@ -70,6 +75,9 @@ config() elif [ -f "$FM_PATH/config/env" ] then ES_HOST=$(cat "$FM_PATH/config/env" | grep ELASTICSEARCH_HOST | awk '{split($0,a,"="); print a[2]}') + else + echo "Fab-manager's environment file not found, please run this script from the installation folder" + exit 1 fi ES_IP=$(getent ahostsv4 "$ES_HOST" | awk '{ print $1 }' | uniq) else @@ -188,6 +196,7 @@ detect_installation() else echo "Note: You can use \`docker logs CONTAINER\` to view the logs"; fi + exit 2 fi fi fi