Merge "Adds ability to override service name for service catalog"

This commit is contained in:
Jenkins 2014-09-03 22:17:34 +00:00 committed by Gerrit Code Review
commit 0c9d060095
2 changed files with 28 additions and 3 deletions

View File

@ -6,6 +6,7 @@
# $auth_name :: identifier used for all keystone objects related to glance. # $auth_name :: identifier used for all keystone objects related to glance.
# Optional. Defaults to glance. # Optional. Defaults to glance.
# $password :: password for glance user. Optional. Defaults to glance_password. # $password :: password for glance user. Optional. Defaults to glance_password.
# $service_name :: name of the service. Optional. Defaults to value of auth_name.
# $service_type :: type of service to create. Optional. Defaults to image. # $service_type :: type of service to create. Optional. Defaults to image.
# $public_address :: Public address for endpoint. Optional. Defaults to 127.0.0.1. # $public_address :: Public address for endpoint. Optional. Defaults to 127.0.0.1.
# $admin_address :: Admin address for endpoint. Optional. Defaults to 127.0.0.1. # $admin_address :: Admin address for endpoint. Optional. Defaults to 127.0.0.1.
@ -22,6 +23,7 @@ class glance::keystone::auth(
$email = 'glance@localhost', $email = 'glance@localhost',
$auth_name = 'glance', $auth_name = 'glance',
$configure_endpoint = true, $configure_endpoint = true,
$service_name = undef,
$service_type = 'image', $service_type = 'image',
$public_address = '127.0.0.1', $public_address = '127.0.0.1',
$admin_address = '127.0.0.1', $admin_address = '127.0.0.1',
@ -34,9 +36,15 @@ class glance::keystone::auth(
$internal_protocol = 'http' $internal_protocol = 'http'
) { ) {
if $service_name == undef {
$real_service_name = $auth_name
} else {
$real_service_name = $service_name
}
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'glance-registry' |> Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'glance-registry' |>
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'glance-api' |> Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'glance-api' |>
Keystone_endpoint["${region}/${auth_name}"] ~> Service <| name == 'glance-api' |> Keystone_endpoint["${region}/${real_service_name}"] ~> Service <| name == 'glance-api' |>
keystone_user { $auth_name: keystone_user { $auth_name:
ensure => present, ensure => present,
@ -50,14 +58,14 @@ class glance::keystone::auth(
roles => 'admin', roles => 'admin',
} }
keystone_service { $auth_name: keystone_service { $real_service_name:
ensure => present, ensure => present,
type => $service_type, type => $service_type,
description => 'Openstack Image Service', description => 'Openstack Image Service',
} }
if $configure_endpoint { if $configure_endpoint {
keystone_endpoint { "${region}/${auth_name}": keystone_endpoint { "${region}/${real_service_name}":
ensure => present, ensure => present,
public_url => "${public_protocol}://${public_address}:${port}", public_url => "${public_protocol}://${public_address}:${port}",
admin_url => "${admin_protocol}://${admin_address}:${port}", admin_url => "${admin_protocol}://${admin_address}:${port}",

View File

@ -116,4 +116,21 @@ describe 'glance::keystone::auth' do
it { should contain_keystone_endpoint('RegionOne/glance').with_notify('Service[glance-api]') } it { should contain_keystone_endpoint('RegionOne/glance').with_notify('Service[glance-api]') }
end end
describe 'when overriding service name' do
let :params do
{
:service_name => 'glance_service',
:password => 'pass'
}
end
it { should contain_keystone_user('glance') }
it { should contain_keystone_user_role('glance@services') }
it { should contain_keystone_service('glance_service') }
it { should contain_keystone_endpoint('RegionOne/glance_service') }
end
end end