c8b7d3319b
For working with Swift backend, Glance needs authentication parameters, which are supplied to Swift when making calls to its storage system. Glance will use information from the file specified under parameter swift_store_config_file. When this parameter is set to the same file (glance-api.conf), we have lot of non-critical errors in glance-api log, because of 'Invalid format of swift store config'. The same problem, when we have RadosGW. Change-Id: I18ee8f68f7ce793d2580685e79ed636556c57ddd Related-bug: #1540890
58 lines
1.2 KiB
Ruby
58 lines
1.2 KiB
Ruby
Puppet::Type.newtype(:glance_swift_config) do
|
|
|
|
ensurable
|
|
|
|
newparam(:name, :namevar => true) do
|
|
desc 'Section/setting name to manage from glance-api.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
|
|
if Facter.value(:osfamily) == 'Debian'
|
|
'glance-api'
|
|
elsif Facter.value(:osfamily) == 'RedHat'
|
|
'openstack-glance'
|
|
end
|
|
end
|
|
|
|
end
|