Skip to content

Instantly share code, notes, and snippets.

@ripienaar
Created June 20, 2019 12:31
Show Gist options
  • Save ripienaar/1e6869a82935969258ce5c0e00a14388 to your computer and use it in GitHub Desktop.
Save ripienaar/1e6869a82935969258ce5c0e00a14388 to your computer and use it in GitHub Desktop.
# .puppetlabs/etc/code/modules/acme/lib/puppet/functions/acme/callstack.rb
Puppet::Functions.create_function(:'acme::callstack') do
dispatch :stack do
end
def stack
Puppet::Pops::PuppetStack.stacktrace()
end
end
$ puppet apply test.pp
Notice: Scope(Class[One]): [/home/rip/test.pp, 3]
Notice: Scope(Class[One]): [/home/rip/test.pp, 8]
Notice: Compiled catalog for dev1.devco.net in environment production in 0.03 seconds
# test.pp
class one {
acme::callstack().each |$trace| {
notice($trace)
}
}
include one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment