Browse code

Merge "Clean up local variable usage - Heat"

Jenkins authored on 2014/08/06 10:51:14
Showing 1 changed files
... ...
@@ -190,6 +190,7 @@ function start_heat {
190 190
 # stop_heat() - Stop running processes
191 191
 function stop_heat {
192 192
     # Kill the screen windows
193
+    local serv
193 194
     for serv in h-eng h-api h-api-cfn h-api-cw; do
194 195
         screen_stop $serv
195 196
     done
... ...
@@ -213,26 +214,26 @@ function disk_image_create {
213 213
 # create_heat_accounts() - Set up common required heat accounts
214 214
 function create_heat_accounts {
215 215
     # migrated from files/keystone_data.sh
216
-    SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
217
-    ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
216
+    local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
217
+    local admin_role=$(openstack role list | awk "/ admin / { print \$2 }")
218 218
 
219
-    HEAT_USER=$(get_or_create_user "heat" \
220
-        "$SERVICE_PASSWORD" $SERVICE_TENANT)
221
-    get_or_add_user_role $ADMIN_ROLE $HEAT_USER $SERVICE_TENANT
219
+    local heat_user=$(get_or_create_user "heat" \
220
+        "$SERVICE_PASSWORD" $service_tenant)
221
+    get_or_add_user_role $admin_role $heat_user $service_tenant
222 222
 
223 223
     if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
224 224
 
225
-        HEAT_SERVICE=$(get_or_create_service "heat" \
225
+        local heat_service=$(get_or_create_service "heat" \
226 226
                 "orchestration" "Heat Orchestration Service")
227
-        get_or_create_endpoint $HEAT_SERVICE \
227
+        get_or_create_endpoint $heat_service \
228 228
             "$REGION_NAME" \
229 229
             "$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s" \
230 230
             "$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s" \
231 231
             "$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s"
232 232
 
233
-        HEAT_CFN_SERVICE=$(get_or_create_service "heat-cfn" \
233
+        local heat_cfn_service=$(get_or_create_service "heat-cfn" \
234 234
                 "cloudformation" "Heat CloudFormation Service")
235
-        get_or_create_endpoint $HEAT_CFN_SERVICE \
235
+        get_or_create_endpoint $heat_cfn_service \
236 236
             "$REGION_NAME" \
237 237
             "$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \
238 238
             "$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \
... ...
@@ -247,36 +248,36 @@ function create_heat_accounts {
247 247
         # heat_stack_owner role is given to users who create Heat stacks,
248 248
         # it's the default role used by heat to delegate to the heat service
249 249
         # user (for performing deferred operations via trusts), see heat.conf
250
-        HEAT_OWNER_ROLE=$(get_or_create_role "heat_stack_owner")
250
+        local heat_owner_role=$(get_or_create_role "heat_stack_owner")
251 251
 
252 252
         # Give the role to the demo and admin users so they can create stacks
253 253
         # in either of the projects created by devstack
254
-        get_or_add_user_role $HEAT_OWNER_ROLE demo demo
255
-        get_or_add_user_role $HEAT_OWNER_ROLE admin demo
256
-        get_or_add_user_role $HEAT_OWNER_ROLE admin admin
254
+        get_or_add_user_role $heat_owner_role demo demo
255
+        get_or_add_user_role $heat_owner_role admin demo
256
+        get_or_add_user_role $heat_owner_role admin admin
257 257
         iniset $HEAT_CONF DEFAULT deferred_auth_method trusts
258 258
     fi
259 259
 
260 260
     if [[ "$HEAT_STACK_DOMAIN" == "True" ]]; then
261 261
         # Note we have to pass token/endpoint here because the current endpoint and
262 262
         # version negotiation in OSC means just --os-identity-api-version=3 won't work
263
-        KS_ENDPOINT_V3="$KEYSTONE_SERVICE_URI/v3"
263
+        local ks_endpoint_v3="$KEYSTONE_SERVICE_URI/v3"
264 264
 
265
-        D_ID=$(openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
265
+        D_ID=$(openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
266 266
             --os-identity-api-version=3 domain list | grep ' heat ' | get_field 1)
267 267
 
268 268
         if [[ -z "$D_ID" ]]; then
269
-            D_ID=$(openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
269
+            D_ID=$(openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
270 270
                 --os-identity-api-version=3 domain create heat \
271 271
                 --description "Owns users and projects created by heat" \
272 272
                 | grep ' id ' | get_field 2)
273 273
             iniset $HEAT_CONF DEFAULT stack_user_domain ${D_ID}
274 274
 
275
-            openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
275
+            openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
276 276
                 --os-identity-api-version=3 user create --password $SERVICE_PASSWORD \
277 277
                 --domain $D_ID heat_domain_admin \
278 278
                 --description "Manages users and projects created by heat"
279
-            openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
279
+            openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
280 280
                 --os-identity-api-version=3 role add \
281 281
                 --user heat_domain_admin --domain ${D_ID} admin
282 282
             iniset $HEAT_CONF DEFAULT stack_domain_admin heat_domain_admin