Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a situation in puppet where I want to inherit from a parametrized class:

class base ($basepath) {

class extends_base ($ext_param) inherits base {

Now trying to instantiate the extends_base class I get the following error message:

Must pass basepath to Class[Base]

However, I don't see a way how to pass the basepath parameter to the Base class.. I tried to pass the param in the Class[Extends_base] definition, puppet doesn't like this either.

share|improve this question
up vote 3 down vote accepted

Puppet does not support inheritance with parameterized base classes, i.e. the base class must not be parameterized for inheritance to work. So what you are trying to do is currently not possible.

See here for details:

share|improve this answer
that's a pitty. Looks like the inheritance concept in puppet doesn't really match with the rest, it seems to be added on top of the existing concepts without adapting to it. – paweloque Oct 30 '12 at 16:47
Puppet's inheritance model doesn't have much in common with inheritance as we know it from object oriented languages. This often leads to surprises when people try to employ it, like in your case. Best to avoid it wholly, as it isn't even that useful in the first place. And now that Hiera is fully integrated in Puppet, the "parameterized class" pattern (the IMHO only useful application of Puppet inheritance, where the main class inherits a params class) can be happily retired. – daff Oct 30 '12 at 20:32
thanks for your detailed explanation! – paweloque Oct 31 '12 at 9:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.