module-puppetdb/lib/puppet/parser/functions/puppetdb_create_subsetting_resource_hash.rb

15 lines
409 B
Ruby
Raw Normal View History

2013-02-15 17:16:36 +01:00
module Puppet::Parser::Functions
newfunction(:puppetdb_create_subsetting_resource_hash, :type => :rvalue) do |args|
java_args = args[0]
params = args[1]
resource_hash = {}
java_args.each { |k,v|
item_params = { 'subsetting' => k, 'value' => (v || '') }
item_params.merge!(params)
resource_hash.merge!({ "'#{k}'" => item_params })
}
resource_hash
end
end