Merge pull request #145 from Mirantis/api-bind-address

API bind address customizable
This commit is contained in:
Dan Bode 2012-10-04 11:40:11 -07:00
commit 3a48cb5660
2 changed files with 23 additions and 6 deletions

View File

@ -7,7 +7,8 @@ class nova::api(
$auth_protocol = 'http',
$admin_tenant_name = 'services',
$admin_user = 'nova',
$admin_password = 'passw0rd'
$admin_password = 'passw0rd',
$api_bind_address = '0.0.0.0',
) {
include nova::params
@ -33,6 +34,13 @@ class nova::api(
nova_config { 'api_paste_config': value => '/etc/nova/api-paste.ini'; }
nova_config {
'ec2_listen': value => $api_bind_address;
'osapi_compute_listen': value => $api_bind_address;
'metadata_listen': value => $api_bind_address;
'osapi_volume_listen': value => $api_bind_address;
}
file { '/etc/nova/api-paste.ini':
content => template('nova/api-paste.ini.erb'),
require => Class['nova'],

View File

@ -44,7 +44,7 @@ describe 'nova::api' do
)}
end
describe 'with defaults' do
it 'should use default params for api-paste.init' do
it 'should use default params for api-paste.ini' do
verify_contents(subject, '/etc/nova/api-paste.ini',
[
'[filter:authtoken]',
@ -55,10 +55,14 @@ describe 'nova::api' do
'auth_uri = http://127.0.0.1:35357/v2.0',
'admin_tenant_name = services',
'admin_user = nova',
'admin_password = passw0rd'
'admin_password = passw0rd',
]
)
end
it { should contain_nova_config('ec2_listen').with('value' => '0.0.0.0') }
it { should contain_nova_config('osapi_compute_listen').with('value' => '0.0.0.0') }
it { should contain_nova_config('metadata_listen').with('value' => '0.0.0.0') }
it { should contain_nova_config('osapi_volume_listen').with('value' => '0.0.0.0') }
end
describe 'with params' do
let :params do
@ -69,10 +73,11 @@ describe 'nova::api' do
:auth_protocol => 'https',
:admin_tenant_name => 'service2',
:admin_user => 'nova2',
:admin_password => 'passw0rd2'
:admin_password => 'passw0rd2',
:api_bind_address => '192.168.56.210',
}
end
it 'should use default params for api-paste.init' do
it 'should use default params for api-paste.ini' do
verify_contents(subject, '/etc/nova/api-paste.ini',
[
'[filter:authtoken]',
@ -83,10 +88,14 @@ describe 'nova::api' do
'auth_uri = https://10.0.0.1:1234/v2.0',
'admin_tenant_name = service2',
'admin_user = nova2',
'admin_password = passw0rd2'
'admin_password = passw0rd2',
]
)
end
it { should contain_nova_config('ec2_listen').with('value' => '192.168.56.210') }
it { should contain_nova_config('osapi_compute_listen').with('value' => '192.168.56.210') }
it { should contain_nova_config('metadata_listen').with('value' => '192.168.56.210') }
it { should contain_nova_config('osapi_volume_listen').with('value' => '192.168.56.210') }
end
end
describe 'on rhel' do