Issue #11451 has been updated by R.I. Pienaar.

Christian Warden wrote:
> 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'}
>     }



This is actually

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

When you write code like you did you're just creating one class thats the 
combination of them all 

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

you can't do this twice yes, thats expected behavior
----------------------------------------
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