On 01 Feb 2016, at 19:15, Henrik Lindberg <henrik.lindb...@cloudsmith.com> wrote:
> > That is exactly what you should do. An external (file based epp) when called, > does not get to see variables in the scope from which it was called/used. > This design is deliberate. Think of the template as a function you are > calling, and you have to give it its arguments. In this case the documentation on the website is wrong: https://docs.puppetlabs.com/puppet/latest/reference/lang_template_epp.html#example-template The example just switches from template() to epp() function. According to your writing you must pass all parameters to the epp() function. > > Contrast this with the inline_epp, which you can think of as a > lambda/code-block. Here the code block gets to see the variables in scope, > since it is itself in that scope (part of the same piece of code). > Got it. To be honest: this is ugly. I always thought of epp() being a full replacement for template() without the scope issue. This especially feels bad, when we will have performance improvement for epp in the future. I need to rethink whether inline_epp() is the proper replacement for template() function. > This design makes the code more maintainable and templates more reusable. It > is also easier to test the templates (there is a command line utility (puppet > epp IIRC) that allows you to feed values into a templates and render the > result). > > Hope that helps > - henrik > >> >> Best, >> Martin >> > > > -- > > Visit my Blog "Puppet on the Edge" > http://puppet-on-the-edge.blogspot.se/ > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-dev/n8o7b5%24k5j%241%40ger.gmane.org. > For more options, visit https://groups.google.com/d/optout. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/E26F3ED6-17F6-47FA-A215-2463253858ED%40gmail.com. For more options, visit https://groups.google.com/d/optout.