add parameter for endpoint protocols

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

Change-Id: I5f936593f83ce8f00338709e5864f7d00f9d0d8c
backport: havana
This commit is contained in:
Benedikt Trefzer
2014-03-06 17:12:52 +01:00
committed by Gerrit Code Review
parent 5f8a944a46
commit 50f0716b67
2 changed files with 29 additions and 18 deletions

View File

@@ -63,6 +63,12 @@
# (optional) Protocol to use for the public endpoint. Can be http or https.
# Defaults to 'http'
#
# [*admin_protocol*]
# Protocol for admin endpoints. Defaults to 'http'.
#
# [*internal_protocol*]
# Protocol for internal endpoints. Defaults to 'http'.
#
class nova::keystone::auth(
$password,
$auth_name = 'nova',
@@ -78,7 +84,9 @@ class nova::keystone::auth(
$configure_ec2_endpoint = true,
$cinder = undef,
$public_protocol = 'http',
$configure_endpoint = true
$configure_endpoint = true,
$admin_protocol = 'http',
$internal_protocol = 'http'
) {
if $cinder != undef {
@@ -107,8 +115,8 @@ class nova::keystone::auth(
keystone_endpoint { "${region}/${auth_name}":
ensure => present,
public_url => "${public_protocol}://${public_address}:${compute_port}/${compute_version}/%(tenant_id)s",
admin_url => "http://${admin_address}:${compute_port}/${compute_version}/%(tenant_id)s",
internal_url => "http://${internal_address}:${compute_port}/${compute_version}/%(tenant_id)s",
admin_url => "${admin_protocol}://${admin_address}:${compute_port}/${compute_version}/%(tenant_id)s",
internal_url => "${internal_protocol}://${internal_address}:${compute_port}/${compute_version}/%(tenant_id)s",
}
}
@@ -121,8 +129,8 @@ class nova::keystone::auth(
keystone_endpoint { "${region}/${auth_name}_ec2":
ensure => present,
public_url => "${public_protocol}://${public_address}:${ec2_port}/services/Cloud",
admin_url => "http://${admin_address}:${ec2_port}/services/Admin",
internal_url => "http://${internal_address}:${ec2_port}/services/Cloud",
admin_url => "${admin_protocol}://${admin_address}:${ec2_port}/services/Admin",
internal_url => "${internal_protocol}://${internal_address}:${ec2_port}/services/Cloud",
}
}
}

View File

@@ -78,28 +78,31 @@ describe 'nova::keystone::auth' do
context 'when overriding endpoint params' do
before do
params.merge!(
:public_address => '10.0.0.1',
:admin_address => '10.0.0.2',
:internal_address => '10.0.0.3',
:compute_port => '9774',
:ec2_port => '9773',
:compute_version => 'v2.2',
:region => 'RegionTwo'
:public_address => '10.0.0.1',
:admin_address => '10.0.0.2',
:internal_address => '10.0.0.3',
:compute_port => '9774',
:ec2_port => '9773',
:compute_version => 'v2.2',
:region => 'RegionTwo',
:admin_protocol => 'https',
:internal_protocol => 'https',
:public_protocol => 'https'
)
end
it { should contain_keystone_endpoint('RegionTwo/nova').with(
:ensure => 'present',
:public_url => 'http://10.0.0.1:9774/v2.2/%(tenant_id)s',
:admin_url => 'http://10.0.0.2:9774/v2.2/%(tenant_id)s',
:internal_url => 'http://10.0.0.3:9774/v2.2/%(tenant_id)s'
:public_url => 'https://10.0.0.1:9774/v2.2/%(tenant_id)s',
:admin_url => 'https://10.0.0.2:9774/v2.2/%(tenant_id)s',
:internal_url => 'https://10.0.0.3:9774/v2.2/%(tenant_id)s'
)}
it { should contain_keystone_endpoint('RegionTwo/nova_ec2').with(
:ensure => 'present',
:public_url => 'http://10.0.0.1:9773/services/Cloud',
:admin_url => 'http://10.0.0.2:9773/services/Admin',
:internal_url => 'http://10.0.0.3:9773/services/Cloud'
:public_url => 'https://10.0.0.1:9773/services/Cloud',
:admin_url => 'https://10.0.0.2:9773/services/Admin',
:internal_url => 'https://10.0.0.3:9773/services/Cloud'
)}
end