Fix permissions for tempest.conf
The current script uses 'sudo' to copy tempest.conf.sample and thus
the .conf file gets owned by root. It then makes the permissions 644,
meaning that when the 'stack' user does the iniset() calls, it doesn't
have permisson on the .conf file.
Since the dir has been chowned to the stack user, it seems safe to
just copy the sample file in without sudo. In addition, I moved the
$TEMPEST_CONFIG_DIR creation closer to the copy to make it clearer
what's going on.
Seems to be related to dc4dc7f03335e26ea3d86b6184f0475cc5f3d51b
Fixes bug: #1284378
Change-Id: I103b4e90cbcfa693c9cef319f4135868a1b83de3
diff --git a/lib/tempest b/lib/tempest
index 596750b..83ce5d2 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -87,11 +87,6 @@
local boto_instance_type="m1.tiny"
local ssh_connect_method="fixed"
- if [[ ! -d $TEMPEST_CONFIG_DIR ]]; then
- sudo mkdir -p $TEMPEST_CONFIG_DIR
- fi
- sudo chown $STACK_USER $TEMPEST_CONFIG_DIR
-
# TODO(afazekas):
# sudo python setup.py deploy
@@ -142,8 +137,12 @@
# Create tempest.conf from tempest.conf.sample
# copy every time, because the image UUIDS are going to change
- sudo cp $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG
- sudo chmod 644 $TEMPEST_CONFIG
+ if [[ ! -d $TEMPEST_CONFIG_DIR ]]; then
+ sudo mkdir -p $TEMPEST_CONFIG_DIR
+ fi
+ sudo chown $STACK_USER $TEMPEST_CONFIG_DIR
+ cp $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG
+ chmod 644 $TEMPEST_CONFIG
password=${ADMIN_PASSWORD:-secrete}