On Wed, Jun 13, 2012 at 4:22 PM, Bruno Léon <nonolem...@gmail.com> wrote:
> I'm encountering an issue which I think is a bug, but I want to propose it
> here before filing it for good @puppetlabs,
> and be sure it's not just a misunderstanding.
>
> Actually, I often use a construction where a "main" class would include some
> small others that build a complete
> service (install, config, service )
> Relationship are given (and respected) in the main class between those
> subclasses.
>
> However, I found out that is a defined type is stating that it requires the
> main class, this won't mean it requires the subclasses.
>
> Here is an example, ran on Ubuntu with the package "ldap".
>
> ###################"
> define aaaa () {
>   Class[ 'test'] -> Aaaa[ $name ]
>   file { '/etc/slapd.d/define':
>     ensure  => file,
>     content => 'define',
>   }
> }
>
> class test {
>   Class[ 'install' ] -> Class[ 'config']
>   include install
>   include config
> }
>
> class install {
>   package { 'slapd':
>     ensure => 'present',
>   }
> }
>
> class config {
>   file { '/etc/slapd.d/config':
>     ensure  => file,
>     content => 'config',
>   }
> }
>
> node default {
>   aaaa { 'test': }
>   include test
> }
> ################
>
> notice:
> /Stage[main]//Node[default]/Aaaa[test]/File[/etc/slapd.d/define]/ensure:
> current_value absent, should be file (noop)
> notice: Aaaa[test]: Would have triggered 'refresh' from 1 events
> notice: Node[default]: Would have triggered 'refresh' from 1 events
> notice: /Stage[main]/Install/Package[slapd]/ensure: current_value purged,
> should be present (noop)
> notice: Class[Install]: Would have triggered 'refresh' from 1 events
> notice: /Stage[main]/Config/File[/etc/slapd.d/config]/ensure: current_value
> absent, should be file (noop)
> notice: Class[Config]: Would have triggered 'refresh' from 1 events
> notice: Class[Main]: Would have triggered 'refresh' from 1 events
> notice: Stage[main]: Would have triggered 'refresh' from 3 events
> notice: Finished catalog run in 0.18 seconds
>
> As we can see, the define Aaaa[test] is created before the class, and in
> this case Puppet would fail
> because the folder /etc/slapd.d/ would not exist before the file
> "/etc/slapd.d/define" is created in it.
>
> This could of course be fixed by requiring the subclass "install" directly,
> but I think that is unexpected.
>
> I hope some will be able to shine my lights on this Puppet behaviour.

This is a class containment problem, and the reason why anchor
resource type exists in puppetlabs-stdlib. Here's the ticket:
http://projects.puppetlabs.com/issues/8040

Thanks,

Nan

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

Reply via email to