On Tuesday, June 10, 2014 2:37:42 AM UTC-5, Christian Charpentier wrote:
>
> I have a file accounts.victorbuckservices.com.conf and not an .erb 
> template.
>


Actually, it probably *is* a trivial ERB template, even though it was not 
written as one.  As long as it does not contain the two-character sequence 
"<%", it can be construed as an ERB template containing only template text.

 

> It seems a little weird to me that we have to use template function either 
> for .erb template or file backend.
>
>

You don't have to do so.  If you want specifically to put the verbatim 
contents of a file into a resource property, then you can use the file() 
function 
<http://docs.puppetlabs.com/references/3.5.latest/function.html#file> 
instead.

If you want to provide both the option of using all static content and the 
option of providing dynamic, templated content, however, then using the 
template() function is a pretty simple way of doing so.  Few files that are 
not ERB or similar templates will be misinterpreted by ERB, so you can 
point your resource at either, and it will just work.  This is a question 
of the implementation of your class, which is under your control.

Note also that as far as I know, using the ".erb" file extension is purely 
a convention.  I do not think the template() function requires templates to 
be named that way (and certainly no such requirement seems to be 
documented).  On the other hand, template() does implement some magic 
around modules' 'templates/' directories.  In this case, I think that's 
where the problem resides.  The templating docs 
<http://docs.puppetlabs.com/guides/templating.html#evaluating-templates> 
describe how the template() function resolves template file names.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/32723aeb-5875-45cf-86e9-03c26c0acf05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to