Don't specify a nova region by default

The nova region config option isn't required and doesn't need
to be set when using one region. Remove the default of 'RegionOne'
and don't specify the option at all by default.

Change-Id: Ie17187fcb74d11465cf08d57a85c30766760d7f2
Closes-bug: #1452092
This commit is contained in:
Sam Morrison
2015-05-06 11:54:22 +10:00
parent 679bfdc7cf
commit b7ca195139
3 changed files with 31 additions and 13 deletions

View File

@@ -40,7 +40,7 @@
# CA cert to check against with for ssl keystone. (Defaults to undef)
#
# [*auth_region*]
# The authentication region. Defaults to 'RegionOne'.
# The authentication region. (Defaults to undef)
#
# [*metadata_ip*]
# The IP address of the metadata service. Defaults to '127.0.0.1'.
@@ -83,7 +83,7 @@ class neutron::agents::metadata (
$auth_url = 'http://localhost:35357/v2.0',
$auth_insecure = false,
$auth_ca_cert = undef,
$auth_region = 'RegionOne',
$auth_region = undef,
$metadata_ip = '127.0.0.1',
$metadata_port = '8775',
$metadata_protocol = 'http',
@@ -102,7 +102,6 @@ class neutron::agents::metadata (
'DEFAULT/debug': value => $debug;
'DEFAULT/auth_url': value => $auth_url;
'DEFAULT/auth_insecure': value => $auth_insecure;
'DEFAULT/auth_region': value => $auth_region;
'DEFAULT/admin_tenant_name': value => $auth_tenant;
'DEFAULT/admin_user': value => $auth_user;
'DEFAULT/admin_password': value => $auth_password, secret => true;
@@ -114,23 +113,33 @@ class neutron::agents::metadata (
'DEFAULT/metadata_backlog': value => $metadata_backlog;
}
if $metadata_memory_cache_ttl {
if $auth_region {
neutron_metadata_agent_config {
'DEFAULT/cache_url': value => "memory://?default_ttl=${metadata_memory_cache_ttl}";
'DEFAULT/auth_region': value => $auth_region;
}
} else {
neutron_metadata_agent_config {
'DEFAULT/cache_url': ensure => absent;
'DEFAULT/auth_region': ensure => absent;
}
}
if $metadata_memory_cache_ttl {
neutron_metadata_agent_config {
'DEFAULT/cache_url': value => "memory://?default_ttl=${metadata_memory_cache_ttl}";
}
} else {
neutron_metadata_agent_config {
'DEFAULT/cache_url': ensure => absent;
}
}
if $auth_ca_cert {
neutron_metadata_agent_config {
'DEFAULT/auth_ca_cert': value => $auth_ca_cert;
'DEFAULT/auth_ca_cert': value => $auth_ca_cert;
}
} else {
neutron_metadata_agent_config {
'DEFAULT/auth_ca_cert': ensure => absent;
'DEFAULT/auth_ca_cert': ensure => absent;
}
}

View File

@@ -57,7 +57,7 @@
# [*nova_region_name*]
# (optional) Name of nova region to use. Useful if keystone manages more than
# one region.
# Defaults to 'RegionOne'
# Defaults to undef
#
class neutron::server::notifications (
@@ -70,7 +70,7 @@ class neutron::server::notifications (
$nova_admin_tenant_name = 'services',
$nova_admin_tenant_id = undef,
$nova_admin_password = false,
$nova_region_name = 'RegionOne',
$nova_region_name = undef,
) {
# Depend on the specified keystone_user resource, if it exists.
@@ -92,7 +92,16 @@ class neutron::server::notifications (
'DEFAULT/nova_admin_auth_url': value => $nova_admin_auth_url;
'DEFAULT/nova_admin_username': value => $nova_admin_username;
'DEFAULT/nova_admin_password': value => $nova_admin_password, secret => true;
'DEFAULT/nova_region_name': value => $nova_region_name;
}
if $nova_region_name {
neutron_config {
'DEFAULT/nova_region_name': value => $nova_region_name;
}
} else {
neutron_config {
'DEFAULT/nova_region_name': ensure => absent;
}
}
if $nova_admin_tenant_id {

View File

@@ -29,7 +29,7 @@ describe 'neutron::server::notifications' do
:nova_admin_auth_url => 'http://127.0.0.1:35357/v2.0',
:nova_admin_username => 'nova',
:nova_admin_tenant_name => 'services',
:nova_region_name => 'RegionOne'
:nova_region_name => nil,
}
end
@@ -54,8 +54,8 @@ describe 'neutron::server::notifications' do
is_expected.to contain_neutron_config('DEFAULT/nova_admin_username').with_value('nova')
is_expected.to contain_neutron_config('DEFAULT/nova_admin_password').with_value('secrete')
is_expected.to contain_neutron_config('DEFAULT/nova_admin_password').with_secret( true )
is_expected.to contain_neutron_config('DEFAULT/nova_region_name').with_value('RegionOne')
is_expected.to contain_neutron_config('DEFAULT/nova_admin_tenant_id').with_value('UUID')
is_expected.to contain_neutron_config('DEFAULT/nova_region_name').with_ensure('absent')
end
context 'when overriding parameters' do