I apologize if this horse has already been beaten to death, but I'm
new here and very, very confused. I'm just starting to work with
Puppet and I can not make heads or tails of the language: specifically
how to use parameterized classes. I've spent a week reading the docs
and testing manifests and I can't make any progress.  I have a feeling
that my confusion comes from the fact I have a programming background
and that my understanding of certain terms (i.e. 'class' and 'scope')
don't mean the same thing for Puppet as they do everywhere else.
(And I thought I understood the concept of 'declarative language', but
maybe not.)

Here's an example of what I feel should work:

class bar ($x='default') {
    notify { "x=${x}": }
}

class foo {
    notify { 'Inside class foo': }
    class { 'bar' : x => 'inside foo', }
}

class baz {
    notify { 'Inside class baz': }
    class { 'bar' : x => 'inside baz', }
}

class { 'foo' : }
class { 'baz' : }

However, when I run this I get the following error:

   Duplicate definition: Class[Bar] is already defined in file
test5.pp at line 10; cannot redefine at test5.pp:15

As I understand it, each class definition has it's own scope.  So why
can't I declare the same parameterized class from two different
classes, especially when the parameters are different?  If you can't
do this then what's the point of having them?

My understanding of the docs and how the scoping rules are moving
towards 2.8, seems to imply that 'include' is bad and 'parameterized
classes' are good.  I'm cool with that, in fact I prefer that - it
matches more of style of coding for other languages.

Can somebody please explain what is going on?

thx
Chris.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to