Hi,

I bumped into the following this afternoon (on a 2.7.19 puppet master/agent
combo):

consider a class profile::tomcat in module profile with the following
content:

$ cat modules/profile/manifests/tomcat.pp
class profile::tomcat {

    class { 'tomcat': }
    notice('Class profile::tomcat in module profile')
}

and

$ cat modules/tomcat/manifests/init.pp
class tomcat {

    notice('Class tomcat in module tomcat')
    ...
}

When I include this class profile::tomcat in a node definition, I would
expect it to apply the resources
contained in the main class of the tomcat module (in
modules/tomcat/manifests/init.pp).

Instead I get:

$ puppet apply --modulepath modules --verbose site.pp
Duplicate declaration: Class[Profile::Tomcat] is already declared; cannot
redeclare at /home/bkkrw/Desktop/test/modules/profile/manifests/tomcat.pp:3
on node XXXXXX

If I instead use

class profile::tomcat {

    include tomcat
    notice('Class profile::tomcat in module profile')
}

then the catalog compiles successfully, but instead of applying the tomcat
class from modules/tomcat/manifests/init.pp,
puppet applies the profile::tomcat class:

$ puppet apply --modulepath modules --verbose site.pp
notice: Scope(Class[Profile::Tomcat]): Class profile::tomcat in module
profile
info: Applying configuration version '1350936327'
notice: Finished catalog run in 0.04 seconds

So, apparently the tomcat class included in class profile::tomcat seems to
resolve to the profile::tomcat class itself
instead of the class defined in modules/tomcat/manifests/init.pp.

I can force the behaviour I want by using:

class { '::tomcat':}

or

include ::tomcat

$ puppet apply --modulepath modules --verbose site.pp
notice: Scope(Class[Tomcat]): Class tomcat in module tomcat
notice: Scope(Class[Profile::Tomcat]): Class profile::tomcat in module
profile
info: Applying configuration version '1350936684'
notice: Finished catalog run in 0.05 seconds

I haven't come across this syntax for class declaration before, and
although it seems to work, it is at least
quite counterintuitive, and possibly a bug.
Everything I find seems to confirm that a declaration like "include tomcat"
should just apply the resources
contained in the main class in module tomcat (in manifests/init.pp).

What do you guys think ?

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