refactor nova::keystone::auth to allow version per endpoint

This commit is contained in:
codec 2012-05-01 22:11:12 +02:00
parent f2174b421a
commit 622d479573
2 changed files with 19 additions and 17 deletions

View File

@ -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":

View File

@ -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(