Merge "Perform safety checks in create-stack-user.sh"
This commit is contained in:
commit
5d3e151aa3
@ -15,6 +15,7 @@
|
||||
# and it was time for this nonsense to stop. Run this script as root to create
|
||||
# the user and configure sudo.
|
||||
|
||||
set -o errexit
|
||||
|
||||
# Keep track of the devstack directory
|
||||
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
|
||||
@ -27,12 +28,14 @@ source $TOP_DIR/functions
|
||||
# and ``DISTRO``
|
||||
GetDistro
|
||||
|
||||
# Needed to get ``ENABLED_SERVICES``
|
||||
# Needed to get ``ENABLED_SERVICES`` and ``STACK_USER``
|
||||
source $TOP_DIR/stackrc
|
||||
|
||||
# Give the non-root user the ability to run as **root** via ``sudo``
|
||||
is_package_installed sudo || install_package sudo
|
||||
|
||||
[[ -z "$STACK_USER" ]] && die "STACK_USER is not set. Exiting."
|
||||
|
||||
if ! getent group $STACK_USER >/dev/null; then
|
||||
echo "Creating a group called $STACK_USER"
|
||||
groupadd $STACK_USER
|
||||
|
Loading…
x
Reference in New Issue
Block a user