Ask Your Question

how can I print the original source location of a template in a comment

asked 2015-04-17 11:07:52 -0600

psyber gravatar image

Is there an erb way to print the original source location of a template so I can tell where the template came from i.e.

#<%= magiclocation %>


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-17 15:13:10 -0600

JohnsonEarls gravatar image

This comes from looking at the puppet 3.7.4 source, so this is in no way a supported method and your mileage may vary:


class foo {
    file { '/tmp/foo':
        ensure => present ,
        template => "foo/bar.erb"


<%= @__file__ %>

After puppet apply -e "include foo", /tmp/foo contains:

edit flag offensive delete link more


works exactly as advertised!

psyber gravatar imagepsyber ( 2015-04-27 15:56:50 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2015-04-17 11:07:52 -0600

Seen: 364 times

Last updated: Apr 17 '15