Skip to content

Commit

Permalink
add parameter for endpoint protocols
Browse files Browse the repository at this point in the history
This gives the ability to specify https endpoint for
internal and/or admin endpoints.

Minor changes to solve conflicts in manifests/keystone/auth.pp

(cherry picked from commit 50f0716b67635aa658f4a3b2ef3b720b0ef9c9ab)

Change-Id: I5f936593f83ce8f00338709e5864f7d00f9d0d8c
  • Loading branch information
trefzer committed Mar 13, 2014
1 parent 7f92da6 commit 90dde44
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
19 changes: 14 additions & 5 deletions manifests/keystone/auth.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#
# [*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',
Expand All @@ -13,7 +19,9 @@
$email = 'nova@localhost',
$configure_ec2_endpoint = true,
$cinder = undef,
$public_protocol = 'http'
$public_protocol = 'http',
$admin_protocol = 'http',
$internal_protocol = 'http'
) {

if $cinder != undef {
Expand All @@ -37,11 +45,12 @@
type => 'compute',
description => 'Openstack Compute Service',
}

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",
}

if $configure_ec2_endpoint {
Expand All @@ -53,8 +62,8 @@
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",
}
}
}
29 changes: 16 additions & 13 deletions spec/classes/nova_keystone_endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,28 +78,31 @@
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
Expand Down

0 comments on commit 90dde44

Please sign in to comment.