add parameter for endpoint protocols

This gives the ability to specify https endpoint for
internal and/or admin endpoints.

Change-Id: I1f7d96693a5bc2140041658e77cc7920f9577eac
backport: havana
This commit is contained in:
Benedikt Trefzer 2014-03-06 16:12:51 +01:00 committed by Gerrit Code Review
parent 31ced75334
commit 833c3845a2
2 changed files with 21 additions and 13 deletions

View File

@ -13,6 +13,9 @@
# $port :: Port for endpoint. Needs to match glance api service port. Optional.
# Defaults to 9292.
# $region :: Region where endpoint is set.
# $public_protocol :: Protocol for public endpoint. Optional. Defaults to http.
# $admin_protocol :: Protocol for admin endpoint. Optional. Defaults to http.
# $internal_protocol :: Protocol for internal endpoint. Optional. Defaults to http.
#
class glance::keystone::auth(
$password,
@ -26,7 +29,9 @@ class glance::keystone::auth(
$port = '9292',
$region = 'RegionOne',
$tenant = 'services',
$public_protocol = 'http'
$public_protocol = 'http',
$admin_protocol = 'http',
$internal_protocol = 'http'
) {
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'glance-registry' |>
@ -55,8 +60,8 @@ class glance::keystone::auth(
keystone_endpoint { "${region}/${auth_name}":
ensure => present,
public_url => "${public_protocol}://${public_address}:${port}",
admin_url => "http://${admin_address}:${port}",
internal_url => "http://${internal_address}:${port}",
admin_url => "${admin_protocol}://${admin_address}:${port}",
internal_url => "${internal_protocol}://${internal_address}:${port}",
}
}
}

View File

@ -61,24 +61,27 @@ describe 'glance::keystone::auth' do
end
describe 'when address, region and port are overridden' do
describe 'when address, region, port and protocoll are overridden' do
let :params do
{
:password => 'pass',
:public_address => '10.0.0.1',
:admin_address => '10.0.0.2',
:internal_address => '10.0.0.3',
:port => '9393',
:region => 'RegionTwo'
:password => 'pass',
:public_address => '10.0.0.1',
:admin_address => '10.0.0.2',
:internal_address => '10.0.0.3',
:port => '9393',
:region => 'RegionTwo',
:public_protocol => 'https',
:admin_protocol => 'https',
:internal_protocol => 'https'
}
end
it { should contain_keystone_endpoint('RegionTwo/glance').with(
:ensure => 'present',
:public_url => 'http://10.0.0.1:9393',
:admin_url => 'http://10.0.0.2:9393',
:internal_url => 'http://10.0.0.3:9393'
:public_url => 'https://10.0.0.1:9393',
:admin_url => 'https://10.0.0.2:9393',
:internal_url => 'https://10.0.0.3:9393'
)}
end