On 2014-07-08 20:09, Ben Ford wrote:
I would also like to propose that we use the metaparameter syntax for
defaults as well.

For example, rather than writing this:

#less readable

file {

default:

mode => '0666';

'/tmp/foo': ;
'/tmp/bar': ;

'/tmp/special':
mode => '0777';
}

One would write this:


#more readable

$defaults = {

ensure => file,

mode => '0666',

}
file { [ '/tmp/foo', '/tmp/bar' ]:

attribute_defaults => $defaults,

}
file { '/tmp/special':
mode => '0777',
attribute_defaults => $defaults,
}


The benefits to that approach are that it looks & feels more like the
Puppet language, it's less of a conceptual change going forward, and
it's also easily searchable. It's also possible have multiple default
hash variables in scope and just assign them as needed.


This requires a user to repeat the defaults per titled resource body.

Your example can also be written like this:

file { [ '/tmp/foo', '/tmp/bar' ]:
  attribute => $defaults,
}

file { '/tmp/special':
  mode => '0777',
  attributes => $defaults - mode,
}


- henrik


--

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/ls0ljg%24qq9%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to