From 90dde44bada00784fdd5d4897aeebfa63957603b Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Thu, 6 Mar 2014 17:12:52 +0100 Subject: [PATCH] add parameter for endpoint protocols 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 --- manifests/keystone/auth.pp | 19 ++++++++++---- spec/classes/nova_keystone_endpoint_spec.rb | 29 ++++++++++++--------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index 383f39392..b4acaee31 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -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', @@ -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 { @@ -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 { @@ -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", } } } diff --git a/spec/classes/nova_keystone_endpoint_spec.rb b/spec/classes/nova_keystone_endpoint_spec.rb index a461810be..28830b13e 100644 --- a/spec/classes/nova_keystone_endpoint_spec.rb +++ b/spec/classes/nova_keystone_endpoint_spec.rb @@ -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