Rename nova_paste_api_ini to nova_api_paste_ini

... so that the name is consistent with the other puppet modules.

Change-Id: I8237b7760f3f7a7bf2806524b2582ef85d3bc6d5
This commit is contained in:
Takashi Kajinami 2020-05-02 23:50:29 +09:00
parent e3078760d7
commit b5c5d7acc3
8 changed files with 109 additions and 25 deletions

View File

@ -0,0 +1,22 @@
Puppet::Type.type(:nova_api_paste_ini).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/nova/api-paste.ini'
end
end

View File

@ -1,22 +1,10 @@
Puppet::Type.type(:nova_paste_api_ini).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:nova_api_paste_ini).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
def create
super
warning('nova_paste_api_ini is deprecated. Use nova_api_paste_ini')
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/nova/api-paste.ini'
end
end

View File

@ -0,0 +1,47 @@
Puppet::Type.newtype(:nova_api_paste_ini) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/nova/api-paste.ini'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
def is_to_s( currentvalue )
if resource.secret?
return '[old secret redacted]'
else
return currentvalue
end
end
def should_to_s( newvalue )
if resource.secret?
return '[new secret redacted]'
else
return newvalue
end
end
end
newparam(:secret, :boolean => true) do
desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
newvalues(:true, :false)
defaultto false
end
autorequire(:package) do
'nova-common'
end
end

View File

@ -3,7 +3,7 @@ Puppet::Type.newtype(:nova_paste_api_ini) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/nova/api-paste.ini'
desc 'Section/setting name to manage from /etc/nova/api-paste.ini (DEPRECATED)'
newvalues(/\S+\/\S+/)
end

View File

@ -333,7 +333,7 @@ as a standalone service, or httpd for being run by a httpd server")
}
if ($ratelimits != undef) {
nova_paste_api_ini {
nova_api_paste_ini {
'filter:ratelimit/paste.filter_factory': value => $ratelimits_factory;
'filter:ratelimit/limits': value => $ratelimits;
}

View File

@ -20,6 +20,15 @@
# NOTE: The configuration MUST NOT be already handled by this module
# or Puppet catalog compilation will fail with duplicate resources.
#
# [*nova_api_paste_ini*]
# (optional) Allow configuration of arbitrary Nova paste api configurations.
# The value is an hash of nova_paste_api_ini resources. Example:
# { 'DEFAULT/foo' => { value => 'fooValue'},
# 'DEFAULT/bar' => { value => 'barValue'}
# }
#
# DEPRECATED PARAMETERS
#
# [*nova_paste_api_ini*]
# (optional) Allow configuration of arbitrary Nova paste api configurations.
# The value is an hash of nova_paste_api_ini resources. Example:
@ -29,14 +38,24 @@
#
class nova::config (
$nova_config = {},
$nova_paste_api_ini = {},
$nova_api_paste_ini = {},
# DEPRECATED PARAMETERS
$nova_paste_api_ini = undef,
) {
include nova::deps
if $nova_paste_api_ini != undef {
warning('nova_paste_api_ini is deprecated and will be removed in a future
release. Use nova_api_paste_init')
$nova_api_paste_ini_real = $nova_paste_api_ini
} else {
$nova_api_paste_ini_real = $nova_api_paste_ini
}
validate_legacy(Hash, 'validate_hash', $nova_config)
validate_legacy(Hash, 'validate_hash', $nova_paste_api_ini)
validate_legacy(Hash, 'validate_hash', $nova_api_paste_ini_real)
create_resources('nova_config', $nova_config)
create_resources('nova_paste_api_ini', $nova_paste_api_ini)
create_resources('nova_api_paste_ini', $nova_api_paste_ini_real)
}

View File

@ -0,0 +1,8 @@
---
deprecations:
- |
The ``nova::config::nova_paste_api_ini`` parameter has been deprecated and
will be removed in a future release. Use ``nova_api_paste_ini`` instead.
- |
The ``nova_paste_api_ini`` resource has been deprecated and will be removed
in a future release. Use ``nova_api_paste_ini`` resource instead.

View File

@ -9,7 +9,7 @@ describe 'nova::config' do
'DEFAULT/bar' => { 'value' => 'barValue' },
'DEFAULT/baz' => { 'ensure' => 'absent' }
},
:nova_paste_api_ini => {
:nova_api_paste_ini => {
'DEFAULT/foo2' => { 'value' => 'fooValue' },
'DEFAULT/bar2' => { 'value' => 'barValue' },
'DEFAULT/baz2' => { 'ensure' => 'absent' }
@ -27,9 +27,9 @@ describe 'nova::config' do
}
it {
should contain_nova_paste_api_ini('DEFAULT/foo2').with_value('fooValue')
should contain_nova_paste_api_ini('DEFAULT/bar2').with_value('barValue')
should contain_nova_paste_api_ini('DEFAULT/baz2').with_ensure('absent')
should contain_nova_api_paste_ini('DEFAULT/foo2').with_value('fooValue')
should contain_nova_api_paste_ini('DEFAULT/bar2').with_value('barValue')
should contain_nova_api_paste_ini('DEFAULT/baz2').with_ensure('absent')
}
end
end