hi,

from:

http://docs.puppetlabs.com/puppet/latest/reference/lang_classes.html#declaring-classes

Include-Like vs. Resource-Like

Puppet has two main ways to declare classes: include-like and resource-like.

*Note:* These two behaviors *should not be mixed* for a given class.
Puppet's behavior when declaring or assigning a class with both styles is
undefined, and will sometimes work and sometimes cause compilation failures.


regards,


On Tue, Apr 1, 2014 at 2:15 PM, Bruno Bieth <bie...@gmail.com> wrote:

> Hi,
>
> I've got the following code that works as expected:
>
> class { "c1": }
> class { "c2": }
>
> class c1 {
>   notice "+++"
> }
>
> class c2 {
>   require "c1"
>   notice "+++"
> }
>
> But switching the declaration order of class c1 and c2:
>
> class { "c2": }
> class { "c1": }
>
> class c1 {
>   notice "+++"
> }
>
> class c2 {
>   require "c1"
>   notice "+++"
> }
>
> produces the following error:
>
> Notice: Scope(Class[C1]): +++
> Notice: Scope(Class[C2]): +++
> Error: Duplicate declaration: Class[C1] is already declared; cannot
> redeclare at /vagrant/files/aa.pp:4 on node ubuntu1310.nestle.com
> Error: Duplicate declaration: Class[C1] is already declared; cannot
> redeclare at /vagrant/files/aa.pp:4 on node ubuntu1310.nestle.com
>
> Shouldn't puppet be declarative and insensitive to the declaration order?
>
> Bruno
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/f2766983-529b-4fd7-a3c0-6f48efd45f25%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/f2766983-529b-4fd7-a3c0-6f48efd45f25%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
José Luis Ledesma

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAF_B3ddeAN%3DRjpM8S8RjduwpYhkupb4gVYxOCrHaNft0BA_2xA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to