Skip to content

Commit 3710eec

Browse files
Fix to avoid undefined variables in initial sanity checks
This commit moves check to see if screen is already running after reading stackrc, and changes messages in check if root is running DevStack. STACK_USER is defined in stackrc, and SCREEN_NAME can be replaced with "a non-root account". Change-Id: I022ed1099169a3549b7e31883abe33d6298f6fa5 Closes-Bug: #1362091
1 parent 61a6e25 commit 3710eec

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

stack.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,11 @@ if [[ $EUID -eq 0 ]]; then
6969
echo "You are running this script as root."
7070
echo "Cut it out."
7171
echo "Really."
72-
echo "If you need an account to run DevStack, do this (as root, heh) to create $STACK_USER:"
72+
echo "If you need an account to run DevStack, do this (as root, heh) to create a non-root account:"
7373
echo "$TOP_DIR/tools/create-stack-user.sh"
7474
exit 1
7575
fi
7676

77-
# Check to see if we are already running DevStack
78-
# Note that this may fail if USE_SCREEN=False
79-
if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].$SCREEN_NAME"; then
80-
echo "You are already running a stack.sh session."
81-
echo "To rejoin this session type 'screen -x stack'."
82-
echo "To destroy this session, type './unstack.sh'."
83-
exit 1
84-
fi
85-
8677

8778
# Prepare the environment
8879
# -----------------------
@@ -130,6 +121,7 @@ if [[ -r $TOP_DIR/local.conf ]]; then
130121
done
131122
fi
132123

124+
133125
# ``stack.sh`` is customizable by setting environment variables. Override a
134126
# default setting via export::
135127
#
@@ -158,6 +150,15 @@ if [[ ! -r $TOP_DIR/stackrc ]]; then
158150
fi
159151
source $TOP_DIR/stackrc
160152

153+
# Check to see if we are already running DevStack
154+
# Note that this may fail if USE_SCREEN=False
155+
if type -p screen > /dev/null && screen -ls | egrep -q "[0-9]\.$SCREEN_NAME"; then
156+
echo "You are already running a stack.sh session."
157+
echo "To rejoin this session type 'screen -x stack'."
158+
echo "To destroy this session, type './unstack.sh'."
159+
exit 1
160+
fi
161+
161162

162163
# Local Settings
163164
# --------------

0 commit comments

Comments
 (0)