This patch adds ability to translate network name to UUID when
setting options in ironic_config.
For example to translate network name to uuid for provision_network,
cleaning_network:
ironic_config {
'neutron/cleaning_network': value => 'baremetal', transform_to => 'net_uuid';
'neutron/provisioning_network': value => 'baremetal', transform_to => 'net_uuid';
}
or by defining ::ironic::conductor class with the following variables:
class {'::ironic::conductor':
cleaning_network_name => 'cleaning_network',
provisioning_network_name => 'provisioning_network'
}
Change-Id: I7ee49c6fec7fcbddbd06e401272e83325c8fdc73
56 lines
1.1 KiB
Ruby
56 lines
1.1 KiB
Ruby
Puppet::Type.newtype(:ironic_config) do
|
|
|
|
ensurable
|
|
|
|
newparam(:name, :namevar => true) do
|
|
desc 'Section/setting name to manage from ironic.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
|
|
|
|
newparam(:transform_to)
|
|
|
|
autorequire(:package) do
|
|
'ironic-common'
|
|
end
|
|
|
|
end
|