Issue #5158 has been updated by Thomas Bellman.
Nigel:
No, I haven't had time to look into the Ruby DSL, or even try out 2.6, I'm
afraid.
But, I suppose anything that you can do from the Ruby DSL, you can do from
inside an ERB template as well, since that's just normal Ruby code, right? As
I wrote, I would be fine if I could do something like <%
Puppet::include_erb("library.erb") -%> inside my "real" template file. I would
in fact prefer that to doing template("library.erb", "real-template.erb"), as
it decouples the implementation of real-template.erb from the invocation. (I
suppose it is actually already possible to do that, but I haven't managed to
find out how. And of course, it mustn't be *too* much work to do it inside the
template compared to doing it in the invocation of the template() function.)
To answer your direct question, if it becomes impossible to do from the Puppet
DSL, and lots of work doing it from inside my real template file, that would be
a real pity. I'm certainly not adverse to using a Ruby DSL, but I would
definitely prefer to only use it only for the really tricky situations, and
keep to the Puppet DSL as much as possible. My gut feeling, without having
looked at it, is that the Ruby DSL will probably be nice to use when
implementing complicated defines, instead of doing full custom types, but for
the main job of just writing manifests the Puppet DSL is likely much nicer.
----------------------------------------
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:
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.