Hi John, I think the behavior you discovered is a natural and expected consequence > of Puppet's name scoping and resolution rules. The current namespace is > searched first for unqualified class names. Only if no matching class is > found there will other namespaces be considered. > > The difference between the behavior with parametrized-class syntax and > 'include' for declaring the tomcat class is also normal. It turned out > well in your case by alerting you to the problem, but usually it is a > problem that you need to work around. It is only a bug to declare a class > multiple times when the second or some later declaration is made in the > parametrized style, and then only because of the possibility of > inconsistent parametrization. You can 'include' a class as many times as > you want. >
I understand the difference between the parameterized style and the include syntax. That is something that is explained thoroughly in the documentation. > Finally, although it is usually unnecessary to use absolute class names > (e.g. "::tomcat") to declare classes, that's because name clashes are > fairly rare. Although you found Puppet's behavior surprising, I wouldn't > call it buggy. > What I found surprising, was the fact that the "include tomcat" or "class { 'tomcat': }" syntax is documented everywhere as the declaration of the main class of a module, without any mention of it possibly being "overridden" by this kind of namespace clash. For variables it seems to be well documented that we should use namespacing and top-scoping to avoid these clashes. I used a similar setup to what is described by Craig Dunn (now a Puppetlabs employee) at http://www.craigdunn.org/2012/05/239/, which happens to have the exact same invocation as I did: class profile::tomcat { class { "jdk": } class { "tomcat": } } As this is a blog post, it probably wasn't tested, but it shows there are others who find this kind of invocation intuitive. While it is easy to work around this by top-scoping the class, some form of documented warning might prevent some hairpulling :) Kind regards, k -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@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.