Last active
June 16, 2017 16:14
-
-
Save binford2k/f12a3c05c7933d0ca48bc6c7d56d0725 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } | |
scope.delete('trusted') | |
scope.delete('facts') | |
scope | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment