Skip to content

Instantly share code, notes, and snippets.

Puppet::Parser::Functions.newfunction(:local_scope,
:type => :rvalue,
:doc => <<-'EOS'
Generates the local scope as a hash. This allows you to use epp functions more
or less like erb templates by passing local scope as the parameters argument.
e.g., `content => epp('mymodname/template.epp', local_scope() )`
EOS
) do |args|
scope = self.to_hash
scope.reject! { |key,val| scope['facts'].include? key }