Browse code

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

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