On 2015-16-12 14:18, R.I.Pienaar wrote:
> ----- Original Message -----
>> From: "Henrik Lindberg" <
henrik....@cloudsmith.com>
>
>> - use type system
>> - use EPP instead of ERB
>> - transition from using hira functions to using lookup (and next step to
>> use 'data in environments and modules').
>> - namespace all functions you create
>> - whenever possible write functions in puppet instead of ruby
>> - iterate and use regular resource syntax instead of create_resources
>> - do not iterate by creating resources recursively
>
> What do you mean by this? avoid resource{[array,of,names]: } ?
>
Nah, that is fine. There is nothing to gain by turning that into an
iteration. I meant when it is done recursively. (The only way you could
do iteration in 3.x).
This area is not fully explored; there is no real reason why resource
evaluation is lazy, and if we are changing the style to be production
based (i.e. like Prolog) and allowing specification of the same resource
multiple times and allowing them to merge (with given precedence of
rules), I am not sure if the exact behavior as we have to today can be
retained (the lazy evaluation that ensures that one resource is
completely evaluated before the next (even when done recursively).
Also, it is harder for users to read and understand such code than
explicit iteration, it creates resources in the catalog that are only
there for the sake of iteration, etc.
>> - avoid depending on resource defaults expressions (murky area still)
>
> But the new syntax works yes?
>
Yes, that will continue to work for sure
> file {
> default:
> mode => '0600',
> owner => 'root',
> group => 'root',
> ensure => file,
> '/etc/ssh_host_dsa_key.pub':
> mode => '0644',
> }
>
>> - avoid depending on automatic tagging (murky area still)
>> - document your manifests using Puppet Strings yard compatible syntax
>> - avoid exposing temporary, "private" variables from classes (e.g. use
>> 'with' function for creating temporary local scope).
>
> good stuff
>