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
This commit is contained in:
parent
8ed3e40be8
commit
9b215db569
@ -913,9 +913,9 @@ function get_or_create_role {
|
|||||||
echo $role_id
|
echo $role_id
|
||||||
}
|
}
|
||||||
|
|
||||||
# Gets or adds user role
|
# Gets or adds user role to project
|
||||||
# Usage: get_or_add_user_role <role> <user> <project>
|
# Usage: get_or_add_user_project_role <role> <user> <project>
|
||||||
function get_or_add_user_role {
|
function get_or_add_user_project_role {
|
||||||
# Gets user role id
|
# Gets user role id
|
||||||
local user_role_id=$(openstack role list \
|
local user_role_id=$(openstack role list \
|
||||||
--user $2 \
|
--user $2 \
|
||||||
|
@ -121,7 +121,7 @@ function create_ceilometer_accounts {
|
|||||||
fi
|
fi
|
||||||
if is_service_enabled swift; then
|
if is_service_enabled swift; then
|
||||||
# Ceilometer needs ResellerAdmin role to access swift account stats.
|
# 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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ function create_glance_accounts {
|
|||||||
|
|
||||||
local glance_swift_user=$(get_or_create_user "glance-swift" \
|
local glance_swift_user=$(get_or_create_user "glance-swift" \
|
||||||
"$SERVICE_PASSWORD" "glance-swift@example.com")
|
"$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
|
fi
|
||||||
|
|
||||||
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
|
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
|
||||||
|
12
lib/keystone
12
lib/keystone
@ -365,7 +365,7 @@ function create_keystone_accounts {
|
|||||||
local admin_tenant=$(get_or_create_project "admin")
|
local admin_tenant=$(get_or_create_project "admin")
|
||||||
local admin_user=$(get_or_create_user "admin" "$ADMIN_PASSWORD")
|
local admin_user=$(get_or_create_user "admin" "$ADMIN_PASSWORD")
|
||||||
local admin_role=$(get_or_create_role "admin")
|
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
|
# Create service project/role
|
||||||
get_or_create_project "$SERVICE_TENANT_NAME"
|
get_or_create_project "$SERVICE_TENANT_NAME"
|
||||||
@ -394,10 +394,10 @@ function create_keystone_accounts {
|
|||||||
local demo_user=$(get_or_create_user "demo" \
|
local demo_user=$(get_or_create_user "demo" \
|
||||||
"$ADMIN_PASSWORD" "demo@example.com")
|
"$ADMIN_PASSWORD" "demo@example.com")
|
||||||
|
|
||||||
get_or_add_user_role $member_role $demo_user $demo_tenant
|
get_or_add_user_project_role $member_role $demo_user $demo_tenant
|
||||||
get_or_add_user_role $admin_role $admin_user $demo_tenant
|
get_or_add_user_project_role $admin_role $admin_user $demo_tenant
|
||||||
get_or_add_user_role $another_role $demo_user $demo_tenant
|
get_or_add_user_project_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 $invis_tenant
|
||||||
|
|
||||||
get_or_create_group "developers" "default" "openstack developers"
|
get_or_create_group "developers" "default" "openstack developers"
|
||||||
get_or_create_group "testers" "default"
|
get_or_create_group "testers" "default"
|
||||||
@ -426,7 +426,7 @@ function create_service_user {
|
|||||||
local role=${2:-service}
|
local role=${2:-service}
|
||||||
|
|
||||||
local user=$(get_or_create_user "$1" "$SERVICE_PASSWORD")
|
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.
|
# Configure the service to use the auth token middleware.
|
||||||
|
2
lib/nova
2
lib/nova
@ -383,7 +383,7 @@ function create_nova_accounts {
|
|||||||
if is_service_enabled swift; then
|
if is_service_enabled swift; then
|
||||||
# Nova needs ResellerAdmin role to download images when accessing
|
# Nova needs ResellerAdmin role to download images when accessing
|
||||||
# swift through the s3 api.
|
# 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
|
fi
|
||||||
|
|
||||||
# EC2
|
# EC2
|
||||||
|
@ -620,18 +620,18 @@ function create_swift_accounts {
|
|||||||
die_if_not_set $LINENO swift_tenant_test1 "Failure creating swift_tenant_test1"
|
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")
|
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"
|
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")
|
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"
|
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)
|
local swift_tenant_test2=$(get_or_create_project swifttenanttest2)
|
||||||
die_if_not_set $LINENO swift_tenant_test2 "Failure creating swift_tenant_test2"
|
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")
|
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"
|
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')
|
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"
|
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)
|
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"
|
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
|
# init_swift() - Initialize rings
|
||||||
|
@ -505,7 +505,7 @@ function create_tempest_accounts {
|
|||||||
# between two regular users in separate tenants
|
# between two regular users in separate tenants
|
||||||
get_or_create_project alt_demo
|
get_or_create_project alt_demo
|
||||||
get_or_create_user alt_demo "$ADMIN_PASSWORD" "alt_demo@example.com"
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user