"Correct" is such a nuanced word.  I don't know whether the observed
behavior is by design, but I don't find it surprising.  I would not
have found your expected behavior surprising either, however.

You may be able to achieve your desired result like this:

class { "parent": foo =>  "test" }
class { "child": foo =>  "test" }

Yes, I finally reached the same conclusion. This is exactly how I fixed it.

That is, it is safe to include both a class and one of its subclasses
in the same manifest.  Do be aware, however, that you should create
subclasses *only* to override superclass resource properties.  And
with parameterized classes, you can achieve an equivalent result via
class parameters instead.

In this example I wasn't overriding any property but I was doing so in my "real" case, so inheritance was needed here.

If you want a class that declares all the resources of another, plus
more, then have one class "include" the other instead of inheriting
it.  Except don't do that with parameterized classes: Puppet Labs
recommends against it, and there are practical reasons to avoid doing
so.

That's how I'm doing it when I don't have to override any property. IMHO It's becoming more and more difficult to know what's the correct way to do something since the introduction of the parametrized classes. They are a huge improvement though.

Cheers

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