Issue #5158 has been updated by Thomas Bellman.

Nigel Kersten wrote:
> Thomas Bellman wrote:
> > And that is a valuable feature.  I have a "library template" that only 
> > defines a number of helper functions that I can then use in other 
> > templates, by doing template("library-utilities.erb", 
> > "actual-template.erb").  Otherwise I would have had to duplicate those 
> > helper functions in several of my template files.
> 
> After thinking about this more, it seems like you're mis-using templates here.
> 
> Why not push that "library template" to a proper Ruby class/module in your 
> sitelib
> on the master, and then it's available to be used when you do template 
> evaluation?

Pushing it to a global location doesn't work when you have multiple 
environments.
The modules must be loaded from an environment-specific location.  And it must 
be
loaded anew for each run even from the same environment, because I may have made
changes to it (it is of course enough if they are reloaded if the file has 
changed
since last time).  Also, it must work when using the stand-alone 'puppet apply'.

I am far from an expert on either Ruby or the Puppet internals, so there might 
be
an easy way to acomplish the above.  If so, I'm eager to hear it.  And as I 
wrote
earlier, I'm interrested in the functionality; the syntax isn't so important, as
long as it is reasonably consise.
----------------------------------------
Feature #5158: File resources: Make source/content parameters and the 
file/template functions consistent.
https://projects.puppetlabs.com/issues/5158

Author: Nigel Kersten
Status: Accepted
Priority: High
Assignee: Nigel Kersten
Category: 
Target version: Statler
Affected Puppet version: 
Keywords: usability
Branch: 


We have four main ways we can specify file content in a file resource.

1. The source parameter
2. The content parameter
3. The file function
4. The template function

These behave inconsistently in the following ways.

The source parameter, file function and template function all can take an 
array. For source/file, the first file that exists will be used. For the 
template function, we concatenate the templates instead.

The file function takes fully qualified paths only.
The template function takes fully qualified paths, or dereferences relative 
paths as follows. 'foo/bar.erb' -> modules/foo/templates/bar.erb

The latter problem is relatively easily solved, particularly if we implement 
#4885

We are going to have to break backwards compatibility to solve the first 
problem however.

My feeling is that more people make use of the multi-select logic in the source 
parameter/file function than make use of the concatenation of the template 
function.


-- 
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