From 622d4795732da9b0bb8618b41d387f92fc301e24 Mon Sep 17 00:00:00 2001 From: codec Date: Tue, 1 May 2012 22:11:12 +0200 Subject: [PATCH] refactor nova::keystone::auth to allow version per endpoint --- manifests/keystone/auth.pp | 15 ++++++++------- spec/classes/nova_keystone_endpoint_spec.rb | 21 +++++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index 77a0958fb..146c7bcc0 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -7,7 +7,8 @@ class nova::keystone::auth( $compute_port = '8774', $volume_port = '8776', $ec2_port = '8773', - $version = 'v1.1', + $compute_version = 'v2', + $volume_version = 'v1', $region = 'RegionOne' ) { @@ -27,9 +28,9 @@ class nova::keystone::auth( keystone_endpoint { $auth_name: ensure => present, region => $region, - public_url => "http://${public_address}:${compute_port}/${version}/%(tenant_id)s", - admin_url => "http://${admin_address}:${compute_port}/${version}/%(tenant_id)s", - internal_url => "http://${internal_address}:${compute_port}/${version}/%(tenant_id)s", + public_url => "http://${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", } keystone_service { "${auth_name}_volume": @@ -40,9 +41,9 @@ class nova::keystone::auth( keystone_endpoint { "${auth_name}_volume": ensure => present, region => $region, - public_url => "http://${public_address}:${volume_port}/${version}/%(tenant_id)s", - admin_url => "http://${admin_address}:${volume_port}/${version}/%(tenant_id)s", - internal_url => "http://${internal_address}:${volume_port}/${version}/%(tenant_id)s", + public_url => "http://${public_address}:${volume_port}/${volume_version}/%(tenant_id)s", + admin_url => "http://${admin_address}:${volume_port}/${volume_version}/%(tenant_id)s", + internal_url => "http://${internal_address}:${volume_port}/${volume_version}/%(tenant_id)s", } keystone_service { "${auth_name}_ec2": diff --git a/spec/classes/nova_keystone_endpoint_spec.rb b/spec/classes/nova_keystone_endpoint_spec.rb index 2ee2fabd7..f4cae69a4 100644 --- a/spec/classes/nova_keystone_endpoint_spec.rb +++ b/spec/classes/nova_keystone_endpoint_spec.rb @@ -35,17 +35,17 @@ describe 'nova::keystone::auth' do it { should contain_keystone_endpoint('nova').with( :ensure => 'present', :region => 'RegionOne', - :public_url => 'http://127.0.0.1:8774/v1.1/%(tenant_id)s', - :admin_url => 'http://127.0.0.1:8774/v1.1/%(tenant_id)s', - :internal_url => 'http://127.0.0.1:8774/v1.1/%(tenant_id)s' + :public_url => 'http://127.0.0.1:8774/v2/%(tenant_id)s', + :admin_url => 'http://127.0.0.1:8774/v2/%(tenant_id)s', + :internal_url => 'http://127.0.0.1:8774/v2/%(tenant_id)s' )} it { should contain_keystone_endpoint('nova_volume').with( :ensure => 'present', :region => 'RegionOne', - :public_url => 'http://127.0.0.1:8776/v1.1/%(tenant_id)s', - :admin_url => 'http://127.0.0.1:8776/v1.1/%(tenant_id)s', - :internal_url => 'http://127.0.0.1:8776/v1.1/%(tenant_id)s' + :public_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s', + :admin_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s', + :internal_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s' )} it { should contain_keystone_endpoint('nova_ec2').with( @@ -118,7 +118,8 @@ describe 'nova::keystone::auth' do :compute_port => '9774', :volume_port => '9776', :ec2_port => '9773', - :version => 'v2.1', + :volume_version => 'v2.1', + :compute_version => 'v2.2', :region => 'RegionTwo' } end @@ -126,9 +127,9 @@ describe 'nova::keystone::auth' do it { should contain_keystone_endpoint('nova').with( :ensure => 'present', :region => 'RegionTwo', - :public_url => 'http://10.0.0.1:9774/v2.1/%(tenant_id)s', - :admin_url => 'http://10.0.0.2:9774/v2.1/%(tenant_id)s', - :internal_url => 'http://10.0.0.3:9774/v2.1/%(tenant_id)s' + :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' )} it { should contain_keystone_endpoint('nova_volume').with(