Issue #4242 has been updated by Dan Carley.

Same problem. Slightly different use case.

I have a class which serves as a base class and includes some other sub-classes 
based on the existence of facts. Here's a snippet, simplified for brevity:

<pre>
class system_raid::hardware {
    if $raidtype =~ /^mpt$/ {
        include system_raid::hardware::mpt
    }
    # ..etc..
    file { "/usr/local/sbin/hwraid_monitor.py":
        source      => "puppet:///modules/system_raid/hwraid_monitor.py",
        mode        => 744,
    }
}

class system_raid::hardware::mpt inherits system_raid::hardware {
    package { "mpt-status":
        ensure      => present,
        category    => "sys-block",
    }
    File["/usr/local/sbin/hwraid_monitor.py"] {
        require     +> Package["mpt-status"]
    }
}
</pre>

I seem to recall that my original intention was:

1. Either `include system_raid::hardware` to automatically pull in the correct 
sub-classes or `include` system_raid::hardware::mpt` if I ever wish to use a 
vendor specific sub-class individually.
1. The base class builds up the right `require` dependencies based on the 
sub-classes that are pulled in.

The recursion hadn't really occurred to me before because it seems that it was 
masked in 0.25.0 but I'm not really clear how to rewrite it if the change in 
behaviour is intentional.
----------------------------------------
Bug #4242: behavior change in recursive inclusions
http://projects.puppetlabs.com/issues/4242

Author: Peter Meier
Status: Accepted
Priority: Normal
Assigned to: Matt Robinson
Category: 
Target version: 2.6.0
Affected version: 2.6.0rc3
Keywords: 
Branch: 


The following (rather weird) class setup worked on 0.25.x:

<pre>
# cat foo.pp 
class test {
  notice("test")
  file{'/tmp/a': ensure => file }
  include testa
}
class testa inherits test {
  notice("testa")
}
include test
</pre>

0.25.5:
<pre>
$ puppet foo.pp
notice: Scope(Class[test]): test
notice: Scope(Class[testa]): testa
notice: //test/File[/tmp/a]/ensure: created
</pre>

2.6:
<pre>
$ puppet foo.pp
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
Duplicate definition: File[/tmp/a] is already defined in file /tmp/foo.pp at 
line 3; cannot redefine at /tmp/foo.pp:3 on node puppet.bar.ch
</pre>

If you remove the file statement, we get the following on 2.6:

<pre>
$ puppet foo.pp
[... a lot of messages ...]
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
notice: Scope(Class[Test]): test
stack level too deep at /tmp/foo.pp:3 on node puppet.bar.ch
</pre>

I don't know if the old behavior was actually correct and the new one should be 
fixed, but I think at least the behavior change should be documented somewhere.


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

Reply via email to