From 2daa0b16444f2a2a865b618cbca76fd18c6cd7c6 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 7 Sep 2020 00:01:24 +0900 Subject: [PATCH] Deprecate neutron_api_config Currently puppet-neutron provides 2 resource types, neutorn_api_config and neutron_api_paste_ini, to manage the same file. (/etc/neutron/api-paste.ini) This patch deprecates neutron_api_config so that we can solve this duplication in a future release. Historically neutron_api_config was added before neutron_api_paste_ini, but in puppet-openstack modules we use *_conf type to manage *.conf file in general, so its name is confusing. This patch also removes the implementation to clean up authtoken parameters in api-paste.ini, because that implementation was added to deal with parameter migration from api-paste.ini to neutron.conf, which happened a long ago. Change-Id: I4361ea53bd964a3a4861c4c28abb7063e19ebd94 --- .../neutron_api_paste_ini/ini_setting.rb | 7 +----- lib/puppet/type/neutron_api_config.rb | 2 +- manifests/config.pp | 23 +++++++++++++++---- manifests/server.pp | 9 -------- ...e-neutron_api_config-56e07cb7d3b71a29.yaml | 9 ++++++++ spec/acceptance/neutron_config_spec.rb | 12 +++++----- spec/classes/neutron_config_spec.rb | 12 +++++----- 7 files changed, 42 insertions(+), 32 deletions(-) create mode 100644 releasenotes/notes/deprecate-neutron_api_config-56e07cb7d3b71a29.yaml diff --git a/lib/puppet/provider/neutron_api_paste_ini/ini_setting.rb b/lib/puppet/provider/neutron_api_paste_ini/ini_setting.rb index 838f90da1..3fb1b9191 100644 --- a/lib/puppet/provider/neutron_api_paste_ini/ini_setting.rb +++ b/lib/puppet/provider/neutron_api_paste_ini/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:neutron_api_paste_ini).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:ruby) + :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) ) do def section @@ -19,9 +19,4 @@ Puppet::Type.type(:neutron_api_paste_ini).provide( '/etc/neutron/api-paste.ini' end - # added for backwards compatibility with older versions of inifile - def file_path - self.class.file_path - end - end diff --git a/lib/puppet/type/neutron_api_config.rb b/lib/puppet/type/neutron_api_config.rb index 6b6ef9f73..889f06b55 100644 --- a/lib/puppet/type/neutron_api_config.rb +++ b/lib/puppet/type/neutron_api_config.rb @@ -3,7 +3,7 @@ Puppet::Type.newtype(:neutron_api_config) do ensurable newparam(:name, :namevar => true) do - desc 'Section/setting name to manage from api-paste.ini' + desc 'Section/setting name to manage from api-paste.ini (DEPRECATED!)' newvalues(/\S+\/\S+/) end diff --git a/manifests/config.pp b/manifests/config.pp index e997669e1..ec9d8bb95 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -24,7 +24,7 @@ # [*server_config*] # (optional) Manage configuration of neutron.conf # -# [*api_config*] +# [*api_paste_ini*] # (optional) Manage configuration of api-paste.ini # # [*bgpvpn_bagpipe_config*] @@ -96,12 +96,17 @@ # [*plugin_nsx_config*] # (optional) Manage configuration of plugins/vmware/nsx.ini # +# DEPRECATED PARAMETERS +# +# [*api_config*] +# (optional) Manage configuration of api-paste.ini +# # NOTE: The configuration MUST NOT be already handled by this module # or Puppet catalog compilation will fail with duplicate resources. # class neutron::config ( $server_config = {}, - $api_config = {}, + $api_paste_ini = {}, $bgpvpn_bagpipe_config = {}, $bgpvpn_service_config = {}, $l2gw_agent_config = {}, @@ -125,12 +130,22 @@ class neutron::config ( $plugin_ml2_config = {}, $plugin_nsx_config = {}, $plugin_nvp_config = {}, + # DEPRECATED PARAMETERS + $api_config = undef, ) { include neutron::deps + if $api_config != undef { + warning('The neutron::config::api_config parameter has been deprecated and \ +will be removed in a future release. Use the api_paste_ini parameter instead.') + $api_paste_ini_real = $api_config + } else { + $api_paste_ini_real = $api_paste_ini + } + validate_legacy(Hash, 'validate_hash', $server_config) - validate_legacy(Hash, 'validate_hash', $api_config) + validate_legacy(Hash, 'validate_hash', $api_paste_ini_real) validate_legacy(Hash, 'validate_hash', $bgpvpn_bagpipe_config) validate_legacy(Hash, 'validate_hash', $bgpvpn_service_config) validate_legacy(Hash, 'validate_hash', $l2gw_agent_config) @@ -156,7 +171,7 @@ class neutron::config ( validate_legacy(Hash, 'validate_hash', $plugin_nvp_config) create_resources('neutron_config', $server_config) - create_resources('neutron_api_config', $api_config) + create_resources('neutron_api_paste_ini', $api_paste_ini_real) create_resources('neutron_bgpvpn_bagpipe_config', $bgpvpn_bagpipe_config) create_resources('neutron_bgpvpn_service_config', $bgpvpn_service_config) create_resources('neutron_l2gw_agent_config', $l2gw_agent_config) diff --git a/manifests/server.pp b/manifests/server.pp index 99f6f49ae..79d1d31dd 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -406,16 +406,7 @@ class neutron::server ( } if ($auth_strategy == 'keystone') { - include neutron::keystone::authtoken - - neutron_api_config { - 'filter:authtoken/admin_tenant_name': ensure => absent; - 'filter:authtoken/admin_user': ensure => absent; - 'filter:authtoken/admin_password': ensure => absent; - 'filter:authtoken/identity_uri': ensure => absent; - } - } oslo::middleware { 'neutron_config': diff --git a/releasenotes/notes/deprecate-neutron_api_config-56e07cb7d3b71a29.yaml b/releasenotes/notes/deprecate-neutron_api_config-56e07cb7d3b71a29.yaml new file mode 100644 index 000000000..33a0cb14f --- /dev/null +++ b/releasenotes/notes/deprecate-neutron_api_config-56e07cb7d3b71a29.yaml @@ -0,0 +1,9 @@ +--- +deprecations: + - | + The ``neutron_api_config`` type has been deprecated. + Use the ``neutron_api_paste_ini`` type instead. + - | + The ``neutron::config::api_config`` parameter has been deprecated and will + be removed in a future release. Use the ``neutron::config::api_paste_ini`` + parameter instead. diff --git a/spec/acceptance/neutron_config_spec.rb b/spec/acceptance/neutron_config_spec.rb index 080af0978..2f7c7488b 100644 --- a/spec/acceptance/neutron_config_spec.rb +++ b/spec/acceptance/neutron_config_spec.rb @@ -31,7 +31,7 @@ describe 'basic neutron_config resource' do Exec { logoutput => 'on_failure' } File <||> -> Neutron_config <||> - File <||> -> Neutron_api_config <||> + File <||> -> Neutron_api_paste_ini <||> File <||> -> Neutron_dhcp_agent_config <||> File <||> -> Neutron_fwaas_service_config <||> File <||> -> Neutron_l3_agent_config <||> @@ -102,20 +102,20 @@ describe 'basic neutron_config resource' do file { $neutron_files : ensure => file, } - neutron_api_config { 'DEFAULT/thisshouldexist' : + neutron_api_paste_ini { 'DEFAULT/thisshouldexist' : value => 'foo', } - neutron_api_config { 'DEFAULT/thisshouldnotexist' : + neutron_api_paste_ini { 'DEFAULT/thisshouldnotexist' : value => '', } - neutron_api_config { 'DEFAULT/thisshouldexist2' : + neutron_api_paste_ini { 'DEFAULT/thisshouldexist2' : value => '', ensure_absent_val => 'toto', } - neutron_api_config { 'DEFAULT/thisshouldnotexist2' : + neutron_api_paste_ini { 'DEFAULT/thisshouldnotexist2' : value => 'toto', ensure_absent_val => 'toto', } @@ -589,7 +589,7 @@ describe 'basic neutron_config resource' do EOS - resource_names = ['neutron_api_config', + resource_names = ['neutron_api_paste_ini', 'neutron_config', 'neutron_dhcp_agent_config', 'neutron_fwaas_service_config', diff --git a/spec/classes/neutron_config_spec.rb b/spec/classes/neutron_config_spec.rb index da234c9cf..d4c584f5f 100644 --- a/spec/classes/neutron_config_spec.rb +++ b/spec/classes/neutron_config_spec.rb @@ -22,15 +22,15 @@ describe 'neutron::config' do end end - shared_examples 'neutron_api_config' do + shared_examples 'neutron_api_paste_ini' do let :params do - { :api_config => config_hash } + { :api_paste_ini => config_hash } end it 'configures arbitrary neutron-api-config configurations' do - should contain_neutron_api_config('DEFAULT/foo').with_value('fooValue') - should contain_neutron_api_config('DEFAULT/bar').with_value('barValue') - should contain_neutron_api_config('DEFAULT/baz').with_ensure('absent') + should contain_neutron_api_paste_ini('DEFAULT/foo').with_value('fooValue') + should contain_neutron_api_paste_ini('DEFAULT/bar').with_value('barValue') + should contain_neutron_api_paste_ini('DEFAULT/baz').with_ensure('absent') end end @@ -204,7 +204,7 @@ describe 'neutron::config' do end it_behaves_like 'neutron_config' - it_behaves_like 'neutron_api_config' + it_behaves_like 'neutron_api_paste_ini' it_behaves_like 'neutron_agent_config' it_behaves_like 'neutron_plugin_config' end