Provide default service_name for keystone endpoint

This change updates the manila::keystone::auth class to include a default
service_name of 'manila' so that if a user changes the auth_name, the
service is still created as being related to 'manila'.  This improves the
user experiance when they want to customize the usernames for services.

Change-Id: I8c6240473213b107de862edf359834b5494e9f74
Closes-Bug: #1590040
This commit is contained in:
ZhongShengping 2016-06-12 10:00:35 +08:00
parent 45cfb84c7c
commit 4b9b42d800
3 changed files with 40 additions and 2 deletions

View File

@ -13,6 +13,15 @@
# [*auth_name*]
# Username for Manila service. Optional. Defaults to 'manila'.
#
# [*service_name*]
# (optional) Name of the service.
# Defaults to 'manila'.
#
# [*service_name_v2*]
# (optional) Name of the service.
# Defaults to 'manilav2'.
#
# [*configure_endpoint*]
# [*configure_endpoint*]
# Should Manila endpoint be configured? Optional. Defaults to 'true'.
# API v1 endpoint should be enabled in Icehouse for compatibility with Nova.
@ -84,6 +93,8 @@ class manila::keystone::auth (
$password_v2 = undef,
$auth_name_v2 = 'manilav2',
$auth_name = 'manila',
$service_name = 'manila',
$service_name_v2 = 'manilav2',
$email = 'manila@localhost',
$email_v2 = 'manilav2@localhost',
$tenant = 'services',
@ -113,12 +124,14 @@ class manila::keystone::auth (
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'manila-api' |>
Keystone_user_role["${auth_name_v2}@${tenant}"] ~> Service <| name == 'manila-api' |>
keystone::resource::service_identity { $auth_name:
keystone::resource::service_identity { 'manila':
configure_user => true,
configure_user_role => true,
configure_endpoint => $configure_endpoint,
service_type => $service_type,
service_description => $service_description,
auth_name => $auth_name,
service_name => $service_name,
region => $region,
password => $password,
email => $email,
@ -128,12 +141,14 @@ class manila::keystone::auth (
internal_url => $internal_url,
}
keystone::resource::service_identity { $auth_name_v2:
keystone::resource::service_identity { 'manilav2':
configure_user => true,
configure_user_role => true,
configure_endpoint => $configure_endpoint_v2,
service_type => $service_type_v2,
service_description => $service_description_v2,
auth_name => $auth_name_v2,
service_name => $service_name_v2,
region => $region,
password => $password_v2_real,
email => $email_v2,

View File

@ -0,0 +1,5 @@
---
fixes:
- The keystone auth class has been updated to provide a default service_name
to allow a user to specify a custom auth_name that may not contain the
name of the service.

View File

@ -92,4 +92,22 @@ describe 'manila::keystone::auth' do
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manila::share') }
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manilav2::sharev2') }
end
describe 'when overriding service names' do
before do
params.merge!(
:service_name => 'manila_service',
:service_name_v2 => 'manila_service_v2',
)
end
it { is_expected.to contain_keystone_user('manila') }
it { is_expected.to contain_keystone_user_role('manila@services') }
it { is_expected.to contain_keystone_service('manila_service::share') }
it { is_expected.to contain_keystone_service('manila_service_v2::sharev2') }
it { is_expected.to contain_keystone_endpoint('RegionOne/manila_service::share') }
it { is_expected.to contain_keystone_endpoint('RegionOne/manila_service_v2::sharev2') }
end
end