Issue #4359 has been updated by Stefan Schulte.

You can do something like
<pre>
<% modulepath=File.expand_path(File.join(File.dirname(file), '..')) -%>
Content of static file foo inside modulepath <%= modulepath %>
<%= File.read(File.join(modulepath,'files', 'foo')) %>
</pre>
----------------------------------------
Feature #4359: a way for a template to get its own name, and the directory in 
which it resides
https://projects.puppetlabs.com/issues/4359#change-61005

Author: Alan Barrett
Status: Accepted
Priority: Normal
Assignee: 
Category: functions
Target version: 
Affected Puppet version: 0.25.5
Keywords: 
Branch: 


I'd like templates to be able to output things like "This file was generated by 
puppet using the template <%= template_filename %>".  For this, I'd need puppet 
to provide some sort of $template_filename variable.

I'd also like templates to be able to make decisions based on the existence of 
files with particular names in the module's "templates" or "files" directory.  
(Things like "if filename.$fqdn exists then paste its contents here".)
For this, it would be sufficient for puppet to chdir to the template directory, 
and let the template use ruby code to discover everything else.  I thought 
there was already a feature request to chdir to the template directory, but I 
can't find it.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to