Browse Source

Provide default service_name for keystone endpoint

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

Change-Id: I472dd78c1b4fd8d3d4667aede56358cf6254617d
Closes-Bug: #1590040
changes/45/326645/1
Alex Schultz 6 years ago
parent
commit
8363e51b3c
  1. 11
      manifests/keystone/auth.pp
  2. 5
      releasenotes/notes/keystone-auth-name-6deb28333b29657e.yaml
  3. 12
      spec/classes/ceilometer_keystone_auth_spec.rb

11
manifests/keystone/auth.pp

@ -29,7 +29,7 @@
#
# [*service_name*]
# (Optional) Name of the service.
# Defaults to value of auth_name.
# Defaults to 'ceilometer'.
#
# [*service_type*]
# (Optional) Type of service. Optional.
@ -76,7 +76,7 @@ class ceilometer::keystone::auth (
$auth_name = 'ceilometer',
$configure_user = true,
$configure_user_role = true,
$service_name = undef,
$service_name = 'ceilometer',
$service_type = 'metering',
$service_description = 'Openstack Metering Service',
$region = 'RegionOne',
@ -89,16 +89,15 @@ class ceilometer::keystone::auth (
validate_string($password)
$service_name_real = pick($service_name, $auth_name)
::keystone::resource::service_identity { $auth_name:
::keystone::resource::service_identity { 'ceilometer':
configure_user => $configure_user,
configure_user_role => $configure_user_role,
configure_endpoint => $configure_endpoint,
service_type => $service_type,
service_description => $service_description,
service_name => $service_name_real,
service_name => $service_name,
region => $region,
auth_name => $auth_name,
password => $password,
email => $email,
tenant => $tenant,

5
releasenotes/notes/keystone-auth-name-6deb28333b29657e.yaml

@ -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.

12
spec/classes/ceilometer_keystone_auth_spec.rb

@ -6,6 +6,7 @@ describe 'ceilometer::keystone::auth' do
{
:email => 'ceilometer@localhost',
:auth_name => 'ceilometer',
:service_name => 'ceilometer',
:configure_endpoint => true,
:service_type => 'metering',
:region => 'RegionOne',
@ -43,14 +44,14 @@ describe 'ceilometer::keystone::auth' do
end
it 'configures ceilometer service' do
is_expected.to contain_keystone_service("#{default_params[:auth_name]}::#{default_params[:service_type]}").with(
is_expected.to contain_keystone_service("#{default_params[:service_name]}::#{default_params[:service_type]}").with(
:ensure => 'present',
:description => 'Openstack Metering Service'
)
end
it 'configure ceilometer endpoints' do
is_expected.to contain_keystone_endpoint("#{default_params[:region]}/#{default_params[:auth_name]}::#{default_params[:service_type]}").with(
is_expected.to contain_keystone_endpoint("#{default_params[:region]}/#{default_params[:service_name]}::#{default_params[:service_type]}").with(
:ensure => 'present',
:public_url => default_params[:public_url],
:admin_url => default_params[:admin_url],
@ -70,6 +71,7 @@ describe 'ceilometer::keystone::auth' do
:public_url => 'https://public.host:443/ceilometer_pub',
:admin_url => 'https://admin.host/ceilometer_adm',
:internal_url => 'http://internal.host:80/ceilometer_int',
:service_name => 'bubbles',
})
end
@ -89,14 +91,14 @@ describe 'ceilometer::keystone::auth' do
end
it 'configures ceilometer service' do
is_expected.to contain_keystone_service("#{params[:auth_name]}::#{params[:service_type]}").with(
is_expected.to contain_keystone_service("#{params[:service_name]}::#{params[:service_type]}").with(
:ensure => 'present',
:description => 'Openstack Metering Service'
)
end
it 'configure ceilometer endpoints' do
is_expected.to contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}::#{params[:service_type]}").with(
is_expected.to contain_keystone_endpoint("#{params[:region]}/#{params[:service_name]}::#{params[:service_type]}").with(
:ensure => 'present',
:public_url => params[:public_url],
:admin_url => params[:admin_url],
@ -108,7 +110,7 @@ describe 'ceilometer::keystone::auth' do
before do
params.delete!(:configure_endpoint)
it 'does not configure ceilometer endpoints' do
is_expected.to_not contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}::#{params[:service_type]}")
is_expected.to_not contain_keystone_endpoint("#{params[:region]}/#{params[:service_name]}::#{params[:service_type]}")
end
end
end

Loading…
Cancel
Save