Issue #11451 has been updated by Christian Warden.

I guess I should have marked this as a documentation bug.  The language guide 
should state that multiple definitions of a class result in the union of the 
resources declared within the definitions.

Also, the language guide says that
    It’s not dangerous to reference a class with a require more than once. 
Classes are evaluated using the include function (which we will mention later). 
If a class has already been evaluated once, then include essentially does 
nothing.

It should state that using the `class { }` method to declare a class more than 
once does not work (or the code should be changed to make it work like 
`include`).

Finally, the error should be "Duplicate **declaration**", not **definition**.
----------------------------------------
Bug #11451: multiple definitions of class allowed; multiple declarations gives 
misleading error
https://projects.puppetlabs.com/issues/11451

Author: Christian Warden
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


A class can be defined multiple times, but when a class is declared multiple 
times, the error is "Duplicate definition".
    class test {
      file { '/tmp/test1.txt': content => 'test1'}
    }

    class test {
      file { '/tmp/test2.txt': content => 'test2'}
    }

    class { 'test': }
    class { 'test': }

This results in an error of
    Duplicate definition: Class[Test] is already defined in file /tmp/test.pp 
at line 9; cannot redefine at /tmp/test.pp:10 on node example.com


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