Browse code

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

Ian Wienand authored on 2014/02/24 13:40:42
Showing 1 changed files
... ...
@@ -87,11 +87,6 @@ function configure_tempest() {
87 87
     local boto_instance_type="m1.tiny"
88 88
     local ssh_connect_method="fixed"
89 89
 
90
-    if [[ ! -d $TEMPEST_CONFIG_DIR ]]; then
91
-        sudo mkdir -p $TEMPEST_CONFIG_DIR
92
-    fi
93
-    sudo chown $STACK_USER $TEMPEST_CONFIG_DIR
94
-
95 90
     # TODO(afazekas):
96 91
     # sudo python setup.py deploy
97 92
 
... ...
@@ -142,8 +137,12 @@ function configure_tempest() {
142 142
 
143 143
     # Create tempest.conf from tempest.conf.sample
144 144
     # copy every time, because the image UUIDS are going to change
145
-    sudo cp $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG
146
-    sudo chmod 644 $TEMPEST_CONFIG
145
+    if [[ ! -d $TEMPEST_CONFIG_DIR ]]; then
146
+        sudo mkdir -p $TEMPEST_CONFIG_DIR
147
+    fi
148
+    sudo chown $STACK_USER $TEMPEST_CONFIG_DIR
149
+    cp $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG
150
+    chmod 644 $TEMPEST_CONFIG
147 151
 
148 152
     password=${ADMIN_PASSWORD:-secrete}
149 153