----- "Jeff McCune" <j...@puppetlabs.com> wrote:

> On Thu, Jul 29, 2010 at 12:07 PM, R.I.Pienaar <r...@devco.net> wro>
> > ----- "Jeff McCune" <j...@puppetlabs.com> wrote:
> >
> >> I make the recommendation that classes should include the classes
> >> they depend on, but this appears to be problematic if the class
> doing the
> >> include sets resource defaults, particularity when setting a
> >> relationship in a default like require, before, subscribe and
> notify.
> >> This opens up the door for resource cycles.
> >
> > recommendations are fine, but that is a lot of convention and best
> > practice something that is very hard to pass on to new people, its
> hard
> > to audit and its hard to predict.  And ones established as a best
> practise
> > that causes problems when ignored also lulls one into a false sense
> of
> > safety.
> 
> Agreed.  As you mentioned this has been on my mind for quite a while
> now.  The unpredictability of scope when a class is included multiple
> times has been pushed to front of my mind since it's been such a
> common point of confusion when talking with many people, both new and
> experienced.
> 
> > best avoided, it should do the right thing by default.
> 
> Agreed.  This begs the question; what is the "right thing" puppet
> should be doing by default?
> 
> >> Perhaps it might be useful to set resource defaults only for the
> >> local scope, and not for any classes which get included into this
> scope.
> >> How do you feel about this change to the language?
> >
> > I've thought about this problem before and thought the fact that
> puppet
> > did not behave in this way was a bug, so my vote is with this :)
> 
> Do you think resource defaults should default to the local scope if
> the default isn't declared in the top or node scope?

I had not considered the global scope defaults, I dont use them cos I
like the side effect of a manifest to be clear when looking at a single
pp file.  I'd only ever set a default that I expect to be localized 
to the class its in.  but thats just me as Nigel points out :)


> Perhaps it would be sufficient to prevent "include" from granting
> access to the local scope and instead limit scope to namespaces and
> class inheritance?
> 
> I'm not too familiar with the code inside of puppet at this level, so
> it may be far more sensible to just introduce a "local" keyword to
> declare resource defaults in the local scope only, but I'm not sure
> this wouldn't satisfy the "behave by default" goal we have.
> 

I guess so, it sounds all a bit magic really.  If this doable then kewl,
otherwise some new syntax for indicating global scoped defaults.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to