Issue #10848 has been updated by Matthaus Litteken.
Status changed from Unreviewed to Rejected
If you replace
class virtcluster::autofs {
class { autofs: }
}
with
class virtcluster::autofs {
class { ::autofs: }
}
it works fine. In your example the lookup happens in the following order...
virtcluster::autofs
::autofs
Because an autofs class is found at virtcluster::autofs, that is what puppet
uses.
In the updated example, lookup starts at ::autofs and as autofs is found there,
that is what puppet uses.
Namespace lookups are relative to the current namespace (virtcluster::autofs),
so it starts there and works toward top level. Adding leading colons will use
absolute namespace lookup rather than relative lookup. This is the way
namespaces are looked up during compilation and while counterintuitive, this is
the expected behavior.
----------------------------------------
Bug #10848: When is "class { foo: }" not equivalent to "include foo"?
https://projects.puppetlabs.com/issues/10848
Author: Lars Kellogg-Stedman
Status: Rejected
Priority: Normal
Assignee:
Category:
Target version:
Affected Puppet version:
Keywords:
Branch:
If I have:
modules/
autofs/
manifests/
init.pp
virtcluster/
manifests/
autofs.pp
And in autofs/manifests/init.pp I have:
class autofs {
}
And in virtcluster/manifests/autofs.pp I have:
class virtcluster::autofs {
include autofs
}
This works as intended. However, if I replace `include` with a new-style class
directive:
class virtcluster::autofs {
class { autofs: }
}
This fails with a "duplicate definition" error:
Duplicate definition: Class[Virtcluster::Autofs] is already defined; cannot
redefined at ...
Is this expected? I thought that `class { foo: }` was supposed to be
equivalent to `include foo`, but obviously the semantics are different.
I'm using 2.7.6 right now, but I've seen this with earlier versions as well.
--
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.