Turn off tracing when outputting errors

When outputting these error strings, turn off the tracing so the user
can actually read it.  Also reword the "not root" user message so it
fits into a standard terminal window length.

Change-Id: I466c60865bc1128f4edd219f831a9c6cffa67829
Parital-Bug: #1517199
This commit is contained in:
Ian Wienand
2015-11-27 14:15:56 +11:00
parent 307730acd9
commit 1afc28bf6c

View File

@@ -75,6 +75,7 @@ fi
# Check if run in POSIX shell # Check if run in POSIX shell
if [[ "${POSIXLY_CORRECT}" == "y" ]]; then if [[ "${POSIXLY_CORRECT}" == "y" ]]; then
set +o xtrace
echo "You are running POSIX compatibility mode, DevStack requires bash 4.2 or newer." echo "You are running POSIX compatibility mode, DevStack requires bash 4.2 or newer."
exit 1 exit 1
fi fi
@@ -85,11 +86,11 @@ fi
# action to create a suitable user account. # action to create a suitable user account.
if [[ $EUID -eq 0 ]]; then if [[ $EUID -eq 0 ]]; then
echo "You are running this script as root." set +o xtrace
echo "Cut it out." echo "DevStack should be run as a user with sudo permissions, "
echo "Really." echo "not root."
echo "If you need an account to run DevStack, do this (as root, heh) to create a non-root account:" echo "A \"stack\" user configured correctly can be created with:"
echo "$TOP_DIR/tools/create-stack-user.sh" echo " $TOP_DIR/tools/create-stack-user.sh"
exit 1 exit 1
fi fi
@@ -98,6 +99,7 @@ fi
# virtual env, and will fail in really odd ways if you do this. Make # virtual env, and will fail in really odd ways if you do this. Make
# this explicit as it has come up on the mailing list. # this explicit as it has come up on the mailing list.
if [[ -n "$VIRTUAL_ENV" ]]; then if [[ -n "$VIRTUAL_ENV" ]]; then
set +o xtrace
echo "You appear to be running under a python virtualenv." echo "You appear to be running under a python virtualenv."
echo "DevStack does not support this, as we may break the" echo "DevStack does not support this, as we may break the"
echo "virtualenv you are currently in by modifying " echo "virtualenv you are currently in by modifying "
@@ -111,6 +113,7 @@ fi
# on a lot of different environments, you sometimes run it on the # on a lot of different environments, you sometimes run it on the
# wrong box. This makes there be a way to prevent that. # wrong box. This makes there be a way to prevent that.
if [[ -e $HOME/.no-devstack ]]; then if [[ -e $HOME/.no-devstack ]]; then
set +o xtrace
echo "You've marked this host as a no-devstack host, to save yourself from" echo "You've marked this host as a no-devstack host, to save yourself from"
echo "running devstack accidentally. If this is in error, please remove the" echo "running devstack accidentally. If this is in error, please remove the"
echo "~/.no-devstack file" echo "~/.no-devstack file"