On Wed, Dec 22, 2010 at 08:55:21AM +0200, Alan Barrett wrote:
> On Sun, 19 Dec 2010, Stefan Schulte wrote:
> > If you really depend on your headerline consider the following: Don't
> > use Time.now but use something like
> > File.stat('/etc/puppet/modules/snmp/template/snmp.conf.erb').mtime.gmtime
> > [Maybe theres a way to address the filename from the template itself,
> > but I havent figured that out; __FILE__ and ARGV are not working]
> 
> Feature request #4359 asks for a way that templates can get their own
> name.  It's not possible at the moment.

I just had a look in parser/templatewrapper.rb and it turns out that we
can use a file accessor. At least the following template worked for me:

I am <%= file %>

The content of the file was then:
I am /etc/puppet/modules/test/templates/test.erb

I also updated your feature request.

-Stefan

Attachment: pgpEf84GwEJ2c.pgp
Description: PGP signature

Reply via email to