Issue #18109 has been updated by Chris Spence.
In the example
include test
actually does
include role::test
rather than
include ::test
which isn't actually what I expected when I first ran this code (and the guys I
was with at the time, as new Puppet users, were surprised by this as not being
intuitive). If you assume that the attempt was actually to include the 'top
level scoped' class test (i.e. ::test) rather than the class 'test' in the
current dynamic scope namespace 'role'.
Documenting this behaviour, I agree, is desirable - I would argue for class
namespacing having an implied leading '::' as being more a more likely end user
intention.
----------------------------------------
Bug #18109: Class namespace declaration appears to be dynamically scoped
https://projects.puppetlabs.com/issues/18109#change-87130
* Author: Chris Spence
* Status: Needs More Information
* Priority: Normal
* Assignee: Chris Spence
* Category:
* Target version:
* Affected Puppet version: 2.7.19
* Keywords:
* Branch:
----------------------------------------
In the example below, the class declaration test generates an error
class role::test {
class { 'test': }
#include test
}
Duplicate declaration: Class[Role::Test] is already declared; cannot
redeclare at /etc/puppetlabs/puppet/modules/role/manifests/test.pp:2
as it appears to be attempting to redeclare itself due to dynamic namespacing
in the class { 'test': } declaration.
the 'include test' line also doesn't do the 'right thing' because it declares
the role::test class, however include ::test does the right thing
The workaround is to declare class { '::test': } (or include ::test) , however
I wouldn't expect class declaration lookup to be dynamic as a default - I can
see that dynamic lookup would cause this to happen, but wonder if this
behaviour should be reviewed.
--
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.