On Mon, Apr 11, 2011 at 9:25 PM, John Warburton <[email protected]>wrote:
> OK, I'll bite > > In the newly published Style Guide ( > http://docs.puppetlabs.com/guides/style_guide.html), right at the end it > says > > Modules should avoid the use of extlookup() in favor of ENCs or other > alternatives > For clarity, this should read: in favor of ENCs in combination with parameterized classes But there is no reason as to why. > that is partly my fault. <the following is my opinion, and may or may not express the opinions of PuppetLabs, although I can be pretty persuasive :) > Extlookup provided some necessary pre-2.6.x functionality, namely, a sane way to get around dynamic scoping. given the option between parameterized class combined with an ENC vs. extlookup, I choose parameterized classes+ENC. The reason is readability and encapsulation. In order to understand an implementation of Puppet using extlookup, you have to understand all of your code in its entirety. After all, any code anywhere in your modulepath could be calling extlookup and accessing data. (I would be very interested to hear if anyone has a good pattern for this) With param classes, you can build a layered architecture of classes that pass data to each other through their explicit interfaces. This means that in any given layer, you only have to understand the specified class interfaces and not their internals. It should be clear from the interface how data effects the behavior of a class. At the highest level, you can build composite classess that expose which data can effect the behavior of all of your Puppet code. class { 'myplatform': ntp => 'foo' foo_data => 'foo' foo_server => ''foo } class { 'myapp': appvar1 => '1' appvar2 => '2' } Allowing you to have a single view of how data effects the behavior of your configuration components. as an added benefit, using an ENC with param classes maintains the classes together with all of their passed parameters in $yamldir/node/ for the last run of each node I look forward to further debate :) > We have a rule of thumb where we use the ENC to set specific information > for a host, and extlookup for groups of servers (based on class, location, > etc set in the ENC). It works well, and we even received a thumbs up in a > recent Puppet Labs audit of our manifests as we have clear separation of > configuration and data. > > So, why should we avoid extlookup()? What should we use instead? > > John > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" 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-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Puppet Users" 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-users?hl=en.
