aa4184a043
With the creation of the new openstack_config provider, some processing that was done in designate_config has been centralized in openstack_config. Impacted methods are : * section * setting * separator Also, this commit adds the fact that, when passing a specific string (ensure_absent_val) the provider will behave as if ensure => absent was specified. '<SERVICE DEFAULT>' is the default value for ensure_absent_val. The use case is the following : designate_config { 'DEFAULT/foo' : value => 'bar' } # will work as usual designate_config { 'DEFAULT/foo' : value => '<SERVICE DEFAULT>' } # will mean absent That means that all the current : if $myvar { designate_config { 'DEFAULT/foo' : value => $myvar } } else { designate_config { 'DEFAULT/foo' : ensure => absent } } can be removed in favor of : designate_config { 'DEFAULT/foo' : value => $myvar } If for any reason '<SERVICE DEFAULT>' turns out to be a valid value for a specific parameter. One could by pass that doing the following : designate_config { 'DEFAULT/foo' : value => '<SERVICE DEFAULT>', ensure_absent_val => 'foo' } Change-Id: I16873c60bfce5b2f432f034755b7bfa3f1383dc5 Depends-On: I0eeebde3aac2662cc7e69bfad7f8d2481463a218
54 lines
1.1 KiB
Ruby
54 lines
1.1 KiB
Ruby
Puppet::Type.newtype(:designate_config) do
|
|
|
|
ensurable
|
|
|
|
newparam(:name, :namevar => true) do
|
|
desc 'Section/setting name to manage from designate.conf'
|
|
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
|
|
newvalues(/^[\S ]*$/)
|
|
|
|
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
|
|
|
|
newparam(:ensure_absent_val) do
|
|
desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
|
|
defaultto('<SERVICE DEFAULT>')
|
|
end
|
|
|
|
autorequire(:package) do
|
|
'designate-common'
|
|
end
|
|
|
|
end
|