On 16 Sep 2010, at 1:03 PM, Nigel Kersten wrote:
> On Thu, Sep 16, 2010 at 12:49 PM, Jeff McCune <[email protected]> wrote:
>> Also, please keep in mind this entire discussion applies to resource
>> defaults as well. Whatever behavior we implement for variables should also
>> be implemented for resource defaults.
>
> So the plan is that the only place you can reliably set global resource
> defaults is directly in your site.pp or in an *import* from site.pp ?
I actually prefer this, as a matter of policy. Though we don't use any
third-party Puppet code here yet, I'm looking forward to a future date when
mixing-and-matching Puppet modules from different sources is feasible and
efficient. And in that world, I want more encapsulation in modules, and that
really means lexical, not dynamic scoping. If a module includes classes from
another module, I don't want the former to influence resources in the latter
unexpectedly, via dynamically-inherited defaults.
> and thus not inside a class that may include all your other classes? (we have
> a module 'base' that does all the logic for which other classes should be
> included)
Some of this, I would imagine, can be done by parameterizing your other classes
-- except the resource defaults, of course. Though for that I guess you could
do:
class app_x ($default_file_owner) {
File { owner => $default_file_owner)
... other content ...
}
We have a different way of handling this here, though. I have a 'defaults'
module with contents like:
File { owner => 'root' }
Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin' }
... and so on ...
And virtually all of our other classes inherit the defaults class (or some
other class, which is itself a descendant of defaults). This saves typing,
compacts our code a *lot*, and somewhat reduces errors due to forgetfulness.
--
Ian Ward Comfort <[email protected]>
Systems Team Lead, Academic Computing Services, Stanford University
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" 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-dev?hl=en.