On Thu, Jul 29, 2010 at 12:07 PM, R.I.Pienaar <[email protected]> wro>
> ----- "Jeff McCune" <[email protected]> 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?

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.

-- 
Jeff McCune
http://www.puppetlabs.com/

-- 
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.

Reply via email to