From 9b215db569dcee2e9cd52c3336ba14b73ad05ab0 Mon Sep 17 00:00:00 2001 From: Jamie Lennox Date: Tue, 10 Feb 2015 18:19:57 +1100 Subject: [PATCH] Rename get_or_add_user_role get_or_add_user_role is specific to adding a role on a project. Rename it to get_or_add_user_project_role to allow room for adding a domain specific role function. Change-Id: I999308098d22be9800578ae67144a3b687fbc3be --- functions-common | 6 +++--- lib/ceilometer | 2 +- lib/glance | 2 +- lib/keystone | 12 ++++++------ lib/nova | 2 +- lib/swift | 8 ++++---- lib/tempest | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/functions-common b/functions-common index d3b3c0c73d..6beb670c6c 100644 --- a/functions-common +++ b/functions-common @@ -913,9 +913,9 @@ function get_or_create_role { echo $role_id } -# Gets or adds user role -# Usage: get_or_add_user_role -function get_or_add_user_role { +# Gets or adds user role to project +# Usage: get_or_add_user_project_role +function get_or_add_user_project_role { # Gets user role id local user_role_id=$(openstack role list \ --user $2 \ diff --git a/lib/ceilometer b/lib/ceilometer index f03bab21fc..c449ad243d 100644 --- a/lib/ceilometer +++ b/lib/ceilometer @@ -121,7 +121,7 @@ function create_ceilometer_accounts { fi if is_service_enabled swift; then # Ceilometer needs ResellerAdmin role to access swift account stats. - get_or_add_user_role "ResellerAdmin" "ceilometer" $SERVICE_TENANT_NAME + get_or_add_user_project_role "ResellerAdmin" "ceilometer" $SERVICE_TENANT_NAME fi fi } diff --git a/lib/glance b/lib/glance index c5206d489a..5bd0b8cdf1 100755 --- a/lib/glance +++ b/lib/glance @@ -238,7 +238,7 @@ function create_glance_accounts { local glance_swift_user=$(get_or_create_user "glance-swift" \ "$SERVICE_PASSWORD" "glance-swift@example.com") - get_or_add_user_role "ResellerAdmin" $glance_swift_user $SERVICE_TENANT_NAME + get_or_add_user_project_role "ResellerAdmin" $glance_swift_user $SERVICE_TENANT_NAME fi if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then diff --git a/lib/keystone b/lib/keystone index 79806b8fd1..2da2d1b4f7 100644 --- a/lib/keystone +++ b/lib/keystone @@ -365,7 +365,7 @@ function create_keystone_accounts { local admin_tenant=$(get_or_create_project "admin") local admin_user=$(get_or_create_user "admin" "$ADMIN_PASSWORD") local admin_role=$(get_or_create_role "admin") - get_or_add_user_role $admin_role $admin_user $admin_tenant + get_or_add_user_project_role $admin_role $admin_user $admin_tenant # Create service project/role get_or_create_project "$SERVICE_TENANT_NAME" @@ -394,10 +394,10 @@ function create_keystone_accounts { local demo_user=$(get_or_create_user "demo" \ "$ADMIN_PASSWORD" "demo@example.com") - get_or_add_user_role $member_role $demo_user $demo_tenant - get_or_add_user_role $admin_role $admin_user $demo_tenant - get_or_add_user_role $another_role $demo_user $demo_tenant - get_or_add_user_role $member_role $demo_user $invis_tenant + get_or_add_user_project_role $member_role $demo_user $demo_tenant + get_or_add_user_project_role $admin_role $admin_user $demo_tenant + get_or_add_user_project_role $another_role $demo_user $demo_tenant + get_or_add_user_project_role $member_role $demo_user $invis_tenant get_or_create_group "developers" "default" "openstack developers" get_or_create_group "testers" "default" @@ -426,7 +426,7 @@ function create_service_user { local role=${2:-service} local user=$(get_or_create_user "$1" "$SERVICE_PASSWORD") - get_or_add_user_role "$role" "$user" "$SERVICE_TENANT_NAME" + get_or_add_user_project_role "$role" "$user" "$SERVICE_TENANT_NAME" } # Configure the service to use the auth token middleware. diff --git a/lib/nova b/lib/nova index c760066f15..801378dd97 100644 --- a/lib/nova +++ b/lib/nova @@ -383,7 +383,7 @@ function create_nova_accounts { if is_service_enabled swift; then # Nova needs ResellerAdmin role to download images when accessing # swift through the s3 api. - get_or_add_user_role ResellerAdmin nova $SERVICE_TENANT_NAME + get_or_add_user_project_role ResellerAdmin nova $SERVICE_TENANT_NAME fi # EC2 diff --git a/lib/swift b/lib/swift index d9f750c27f..194df3330d 100644 --- a/lib/swift +++ b/lib/swift @@ -620,18 +620,18 @@ function create_swift_accounts { die_if_not_set $LINENO swift_tenant_test1 "Failure creating swift_tenant_test1" SWIFT_USER_TEST1=$(get_or_create_user swiftusertest1 $swiftusertest1_password "test@example.com") die_if_not_set $LINENO SWIFT_USER_TEST1 "Failure creating SWIFT_USER_TEST1" - get_or_add_user_role admin $SWIFT_USER_TEST1 $swift_tenant_test1 + get_or_add_user_project_role admin $SWIFT_USER_TEST1 $swift_tenant_test1 local swift_user_test3=$(get_or_create_user swiftusertest3 $swiftusertest3_password "test3@example.com") die_if_not_set $LINENO swift_user_test3 "Failure creating swift_user_test3" - get_or_add_user_role $another_role $swift_user_test3 $swift_tenant_test1 + get_or_add_user_project_role $another_role $swift_user_test3 $swift_tenant_test1 local swift_tenant_test2=$(get_or_create_project swifttenanttest2) die_if_not_set $LINENO swift_tenant_test2 "Failure creating swift_tenant_test2" local swift_user_test2=$(get_or_create_user swiftusertest2 $swiftusertest2_password "test2@example.com") die_if_not_set $LINENO swift_user_test2 "Failure creating swift_user_test2" - get_or_add_user_role admin $swift_user_test2 $swift_tenant_test2 + get_or_add_user_project_role admin $swift_user_test2 $swift_tenant_test2 local swift_domain=$(get_or_create_domain swift_test 'Used for swift functional testing') die_if_not_set $LINENO swift_domain "Failure creating swift_test domain" @@ -641,7 +641,7 @@ function create_swift_accounts { local swift_user_test4=$(get_or_create_user swiftusertest4 $swiftusertest4_password "test4@example.com" $swift_domain) die_if_not_set $LINENO swift_user_test4 "Failure creating swift_user_test4" - get_or_add_user_role admin $swift_user_test4 $swift_tenant_test4 + get_or_add_user_project_role admin $swift_user_test4 $swift_tenant_test4 } # init_swift() - Initialize rings diff --git a/lib/tempest b/lib/tempest index 777d03e0f3..560ab1b1e8 100644 --- a/lib/tempest +++ b/lib/tempest @@ -505,7 +505,7 @@ function create_tempest_accounts { # between two regular users in separate tenants get_or_create_project alt_demo get_or_create_user alt_demo "$ADMIN_PASSWORD" "alt_demo@example.com" - get_or_add_user_role Member alt_demo alt_demo + get_or_add_user_project_role Member alt_demo alt_demo fi }