Browse code

Clean up local variable usage - Keystone

Change-Id: I8e5506e9d29879459158ef796854ce7a67107d89

Dean Troyer authored on 2014/07/26 03:40:25
Showing 1 changed files
... ...
@@ -328,11 +328,11 @@ function configure_keystone_extensions {
328 328
 function create_keystone_accounts {
329 329
 
330 330
     # admin
331
-    ADMIN_TENANT=$(get_or_create_project "admin")
332
-    ADMIN_USER=$(get_or_create_user "admin" \
333
-        "$ADMIN_PASSWORD" "$ADMIN_TENANT")
334
-    ADMIN_ROLE=$(get_or_create_role "admin")
335
-    get_or_add_user_role $ADMIN_ROLE $ADMIN_USER $ADMIN_TENANT
331
+    local admin_tenant=$(get_or_create_project "admin")
332
+    local admin_user=$(get_or_create_user "admin" \
333
+        "$ADMIN_PASSWORD" "$admin_tenant")
334
+    local admin_role=$(get_or_create_role "admin")
335
+    get_or_add_user_role $admin_role $admin_user $admin_tenant
336 336
 
337 337
     # Create service project/role
338 338
     get_or_create_project "$SERVICE_TENANT_NAME"
... ...
@@ -347,25 +347,25 @@ function create_keystone_accounts {
347 347
     get_or_create_role ResellerAdmin
348 348
 
349 349
     # The Member role is used by Horizon and Swift so we need to keep it:
350
-    MEMBER_ROLE=$(get_or_create_role "Member")
350
+    local member_role=$(get_or_create_role "Member")
351 351
 
352 352
     # ANOTHER_ROLE demonstrates that an arbitrary role may be created and used
353 353
     # TODO(sleepsonthefloor): show how this can be used for rbac in the future!
354 354
 
355
-    ANOTHER_ROLE=$(get_or_create_role "anotherrole")
355
+    local another_role=$(get_or_create_role "anotherrole")
356 356
 
357 357
     # invisible tenant - admin can't see this one
358
-    INVIS_TENANT=$(get_or_create_project "invisible_to_admin")
358
+    local invis_tenant=$(get_or_create_project "invisible_to_admin")
359 359
 
360 360
     # demo
361
-    DEMO_TENANT=$(get_or_create_project "demo")
362
-    DEMO_USER=$(get_or_create_user "demo" \
363
-        "$ADMIN_PASSWORD" "$DEMO_TENANT" "demo@example.com")
364
-
365
-    get_or_add_user_role $MEMBER_ROLE $DEMO_USER $DEMO_TENANT
366
-    get_or_add_user_role $ADMIN_ROLE $ADMIN_USER $DEMO_TENANT
367
-    get_or_add_user_role $ANOTHER_ROLE $DEMO_USER $DEMO_TENANT
368
-    get_or_add_user_role $MEMBER_ROLE $DEMO_USER $INVIS_TENANT
361
+    local demo_tenant=$(get_or_create_project "demo")
362
+    local demo_user=$(get_or_create_user "demo" \
363
+        "$ADMIN_PASSWORD" "$demo_tenant" "demo@example.com")
364
+
365
+    get_or_add_user_role $member_role $demo_user $demo_tenant
366
+    get_or_add_user_role $admin_role $admin_user $demo_tenant
367
+    get_or_add_user_role $another_role $demo_user $demo_tenant
368
+    get_or_add_user_role $member_role $demo_user $invis_tenant
369 369
 
370 370
     # Keystone
371 371
     if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then