Issue #7081 has been reported by James Turnbull.

----------------------------------------
Refactor #7081: Update scope documentation
https://projects.puppetlabs.com/issues/7081

Author: James Turnbull
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Keywords: 
Branch: 
Affected URL: 


The primary layout for defines and classes has always been via the autoloader 
in a layout like:

$modulepath/foo/manifests/init.pp -> class foo { ... }

$modulepath/foo/manifests/bar.pp -> class foo::bar { ... }

$modulepath/foo/manifests/mydefine.pp -> define foo::mydefine() { ... }

The behavior of defines with class inheritance where you've mixed the define 
inside a class definition had some issues, particularly when it came to mixing 
variables that were overriden in an inherited class.

Our recommendation is that you always refer to variables external to the 
current class by their fully-qualified name, e.g:

$another_class::foo

rather than relying upon the dynamic scoping behavior of class inclusion, and 
following the same method for defines is a good idea for the same reasons, 
namely that you avoid a lot of problematic edge cases.

We've recently published a style guide that contains our suggested approach:

http://docs.puppetlabs.com/guides/style_guide

Also convert 
http://projects.puppetlabs.com/projects/puppet/wiki/Scope_and_Puppet into a 
docs based scoping document.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to