Add ability to not configure EC2 endpoint

As EC2 api can be disabled by removing it from enabled_apis
in nova::api, this patch adds the ability to not configure
the EC2 service and endpoint in keystone.

Change-Id: I97790cc44418a00696cf294158ce47511fdc1918
This commit is contained in:
Mathieu Gagné
2013-05-14 19:50:11 -04:00
parent f0674053aa
commit 7de7e1bed7
2 changed files with 47 additions and 53 deletions

View File

@@ -12,6 +12,7 @@ class nova::keystone::auth(
$region = 'RegionOne',
$tenant = 'services',
$email = 'nova@localhost',
$configure_ec2_endpoint = true,
$cinder = false,
$public_protocol = 'http'
) {
@@ -52,6 +53,7 @@ class nova::keystone::auth(
}
}
if $configure_ec2_endpoint {
keystone_service { "${auth_name}_ec2":
ensure => present,
type => 'ec2',
@@ -63,5 +65,5 @@ class nova::keystone::auth(
admin_url => "http://${admin_address}:${ec2_port}/services/Admin",
internal_url => "http://${internal_address}:${ec2_port}/services/Cloud",
}
}
}

View File

@@ -2,12 +2,12 @@ require 'spec_helper'
describe 'nova::keystone::auth' do
describe 'with defaults' do
let :params do
{:password => 'nova_password'}
end
context 'with default parameters' do
it { should contain_keystone_user('nova').with(
:ensure => 'present',
:password => 'nova_password'
@@ -59,10 +59,9 @@ describe 'nova::keystone::auth' do
end
describe 'when setting auth name' do
let :params do
{:password => 'nova_password', :auth_name => 'foo' }
context 'when setting auth name' do
before do
params.merge!( :auth_name => 'foo' )
end
it { should contain_keystone_user('foo').with(
@@ -95,25 +94,9 @@ describe 'nova::keystone::auth' do
end
describe 'when setting password' do
let :params do
{ :password => 'pass'}
end
it { should contain_keystone_user('nova').with(
:ensure => 'present',
:password => 'pass'
) }
end
describe 'when overriding endpoint params' do
let :params do
{
:password => 'nova_password',
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',
@@ -123,7 +106,7 @@ describe 'nova::keystone::auth' do
:volume_version => 'v2.1',
:compute_version => 'v2.2',
:region => 'RegionTwo'
}
)
end
it { should contain_keystone_endpoint('RegionTwo/nova').with(
@@ -149,4 +132,13 @@ describe 'nova::keystone::auth' do
end
describe 'when disabling EC2 endpoint' do
before do
params.merge!( :configure_ec2_endpoint => false )
end
it { should_not contain_keystone_service('nova_ec2') }
it { should_not contain_keystone_endpoint('RegionOne/nova_ec2') }
end
end