puppet-pacemaker/lib/puppet/parser/functions/pacemaker_resource_paramete...

24 lines
536 B
Ruby

module Puppet::Parser::Functions
newfunction(
:pacemaker_resource_parameters,
type: :rvalue,
arity: -1,
doc: <<-eof
Gather resource parameters and their values
eof
) do |args|
parameters = {}
args.flatten.each_slice(2) do |key, value|
if value.nil? and key.is_a? Hash
parameters.merge! key
else
next if key.nil?
next if value.nil?
next if value == ''
key = key.to_s
parameters.store key, value
end
end
parameters
end
end