On 24/12/10 11:11, Daniel Piddock wrote:
> Hey all,
>
> I'm not sure if I've made a fundamental misunderstanding of Puppet
> namespacing and include resolution or whether there's a bug.
>
> Background:
> I have a modules, called kerberos, that configures a client for working
> on my kerberos domain. I then have a module called ssh that sets up a
> basic sshd. I wanted to create a ssh::kerberos class in the ssh module
> that extends my ssh setup with kerberos support. I wanted to put a
> dependency on the kerberos module. However things fell apart and there
> was lots of hair tearing thinking I'd done something stupid (e.g. a
> typo.) I now believe it's not that simple...
>
> [Contrived, simplistic example]
> Take a module called "t" that creates a folder:
> /etc/puppet/modules/t/manifests/init.pp:
>   class t {
>     file { '/tmp/t': ensure => directory }
>   }
>
> Create another module called test, that creates a file in that directory:
> /etc/puppet/modules/test/manifests/init.pp
>   class test {
>     include t
>     file { '/tmp/t/foo':
>       ensure => file,
>       require => File['/tmp/t'],
>     }
>
> Everything's super happy and fine. I have /tmp/t/foo. puppet agent
> --test --debug:
> info: Caching catalog for debian.localdomain
> debug: Creating default schedules
> debug: Loaded state in 0.00 seconds
> debug: /Stage[main]/Test/File[/tmp/t/foo]/require: requires File[/tmp/t]
> info: Applying configuration version '1293188258'
> notice: /Stage[main]/T/File[/tmp/t]/ensure: created
> notice: /Stage[main]/Test/File[/tmp/t/foo]/ensure: created
> debug: Finishing transaction -615069188
> debug: Storing state
> debug: Stored state in 0.01 seconds
> notice: Finished catalog run in 0.03 seconds
>
> Now, create a test::t class.
> /etc/puppet/modules/test/manifests/t.pp:
>   class test::t {
>   }
>
> It falls apart. Puppet resolves the "include t" as being the subclass of
> test, rather than the module:
> info: Caching catalog for debian.localdomain
> debug: Creating default schedules
> err: Could not run Puppet configuration client: Could not find
> dependency File[/tmp/t] for File[/tmp/t/foo] at
> /etc/puppet/modules/test/manifests/init.pp:6
>
> Replacing the require with Class['t'] is rather more telling in the debug:
> info: Caching catalog for debian.localdomain
> debug: Creating default schedules
> debug: Loaded state in 0.00 seconds
> debug: /Stage[main]/Test/File[/tmp/t/foo]/require: requires Class[Test::T]
> info: Applying configuration version '1293188643'
> err: /Stage[main]/Test/File[/tmp/t/foo]/ensure: change from absent to
> file failed: Could not set 'file on ensure: No such file or directory -
> /tmp/t/foo at /etc/puppet/modules/test/manifests/init.pp:6
> debug: Finishing transaction -614790778
> debug: Storing state
> debug: Stored state in 0.01 seconds
> notice: Finished catalog run in 0.03 seconds
>
> Is this by design? If so, how do I specify module, not subclass, in the
> include/require?
> Is there a bug?

I should have mentioned that I first got the issue under 2.6.2 but have
also tested under 2.6.4

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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.

Reply via email to