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
This commit is contained in:
Takashi Kajinami 2020-09-07 00:01:24 +09:00
parent e656d11e78
commit 2daa0b1644
7 changed files with 42 additions and 32 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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':

View File

@ -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.

View File

@ -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 => '<SERVICE DEFAULT>',
}
neutron_api_config { 'DEFAULT/thisshouldexist2' :
neutron_api_paste_ini { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
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',

View File

@ -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