diff --git a/manifests/agents/metadata.pp b/manifests/agents/metadata.pp index 874c809a6..32fd64a38 100644 --- a/manifests/agents/metadata.pp +++ b/manifests/agents/metadata.pp @@ -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; } } diff --git a/manifests/server/notifications.pp b/manifests/server/notifications.pp index 8cfb6d7fe..4a6f7db8e 100644 --- a/manifests/server/notifications.pp +++ b/manifests/server/notifications.pp @@ -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 { diff --git a/spec/classes/neutron_server_notifications_spec.rb b/spec/classes/neutron_server_notifications_spec.rb index 9a7820e78..07e806f36 100644 --- a/spec/classes/neutron_server_notifications_spec.rb +++ b/spec/classes/neutron_server_notifications_spec.rb @@ -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