On 2013-03-05 23:46, Henrik Lindberg wrote:
Hi,
I have now finished the work on "ARM-3 Puppet Templates" - the proposal
is here:
https://github.com/puppetlabs/armatures/blob/master/arm-3.puppet_templates/puppet_templates.md


There is also a full implementation available from my branch here:
https://github.com/hlindberg/puppet/tree/feature/master/templates

(this implementation also includes ARM-4 Heredoc).

In short Embedded Puppet Templates (EPP) is an ERB replacement that
works the same way as ERB, but the logic is written in the Puppet Language.


Validation Option
-------
One thing I forgot to add is that it may be a good idea to be able to declare that validation is wanted inside of the template. Although a file extension like .html.epp states that this is supposed to result in html, the same does not exist when using an inline template.

It is also diffult to know if the template is just a snippet that is later merged with other content.

In ARM-4 Heredoc, the same is achieved by using ':syntax' in the opening heredoc tag (this will trigger validation of the prouced content). The same could be done for EPP. e.g.

File: atemplate.epp
---
<% ($x,$y) : json %>
This is supposed to be valid json text
---

Since this is implemented for heredoc, it is trivial to add validation also of the result produced by a template.

Do you think it is of value to be able to validate the produced result?
(To get errors immediately as opposed to when the content of some file is much later used by an agent).

Restricted Scope
-------
Another idea I did not explore in the proposal is if it is of value to provide a restricted scope where access is only given to variables that are passed to the template. If so, this should be something that is specified in the call to epptemplate(), or inline_epptemplate(), but their signatures modeled after the corresponding erb based functions does not easily handle this.

Do you think it is a good idea to be able to restrict the template to only see the given variables?

Regards
- henrik


--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-dev@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to