Browse code

Merge "Perform safety checks in create-stack-user.sh"

Jenkins authored on 2014/02/25 11:51:45
Showing 1 changed files
... ...
@@ -15,6 +15,7 @@
15 15
 # and it was time for this nonsense to stop.  Run this script as root to create
16 16
 # the user and configure sudo.
17 17
 
18
+set -o errexit
18 19
 
19 20
 # Keep track of the devstack directory
20 21
 TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
... ...
@@ -27,12 +28,14 @@ source $TOP_DIR/functions
27 27
 # and ``DISTRO``
28 28
 GetDistro
29 29
 
30
-# Needed to get ``ENABLED_SERVICES``
30
+# Needed to get ``ENABLED_SERVICES`` and ``STACK_USER``
31 31
 source $TOP_DIR/stackrc
32 32
 
33 33
 # Give the non-root user the ability to run as **root** via ``sudo``
34 34
 is_package_installed sudo || install_package sudo
35 35
 
36
+[[ -z "$STACK_USER" ]] && die "STACK_USER is not set. Exiting."
37
+
36 38
 if ! getent group $STACK_USER >/dev/null; then
37 39
     echo "Creating a group called $STACK_USER"
38 40
     groupadd $STACK_USER