Issue #5046 has been updated by Jon McKenzie.

I'm having a similar seeming issue to this report (duplicate class declarations 
depending on manifest ordering), however I'm not declaring the same class 
multiple times nor are parameters involved. Here's a way to reproduce my issue:

1. Create a test module called 'foo' with the following classes/content:

init.pp:

<pre>
class foo { }
</pre>

bar.pp:

<pre>
class foo::bar {
  require 'foo::baz'
}
</pre>

baz.pp:

<pre>
class foo::baz { }
</pre>

bam.pp:

<pre>
class foo::bam {
  include 'foo::bar'
  class {'foo::baz': }
}
</pre>

2. Run <code>puppet apply -e 'include foo::bam'</code>. Running Puppet 3.3.1, I 
get a duplicate declaration error on the "foo::baz" class (even though it's 
only declared a single time).

3. Edit bam.pp and reverse the ordering of the 'include' and 'class' 
statements, e.g.:

<pre>
class foo::bam {
  class {'foo::baz': }
  include 'foo::bar'
}
</pre>

4. Re-run the 'puppet apply'. No errors are produced.

Any idea if this is related to this report?



----------------------------------------
Bug #5046: Mixed invocation of parameterized classes leads to order 
dependencies, should be disallowed
https://projects.puppetlabs.com/issues/5046#change-99910

* Author: Paul Berry
* Status: Needs Decision
* Priority: Normal
* Assignee: eric sorenson
* Category: language
* Target version: 3.x
* Affected Puppet version: 
* Keywords: parameterized_classes
* Branch: 
----------------------------------------
When a parameterized class has default values for all of its parameters, it may 
be invoked using either "include" or "class { ... }" notation.  The "include" 
notation is idempotent; the "class { ... }" notation isn't.  As a result, there 
is an order dependency.  This works:

<pre>
class foo($param = defaultvalue) {
  notify { $param: }
}

class { foo: param => value }
include foo
</pre>

But this produces an error:

<pre>
class foo($param = defaultvalue) {
  notify { $param: }
}

include foo
class { foo: param => value }
</pre>

In large manifests, it is not always obvious (or even well-defined) what order 
statements will be executed in.  To avoid user confusion, I think it would be 
preferable if both these examples produced an error message saying something 
like "class foo already invoked using 'class { ... }' syntax, cannot also 
invoke using 'include'".

NF: Note that the "inherits" keyword declares the base class in a manner 
similar to "include," which means that if you declare a subclass of class foo 
(`class baz inherits foo {...} ... include baz`) and then declare class foo 
with the resource-like syntax (`class {'foo':}`), it'll blow up in the same way 
as described above. 


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to