Hello

I have some puppet code that does the equivalent of the following. The
idea is to have a define "foo" with some actions that must be executed
before it runs ("foo::pre"). Since the resources in "foo::pre" can
only be defined once, it's implemented as a class, and included from
the define:

class foo::pre {
  notice("foo::pre")
}
define foo() {
  include 'foo::pre'
  notice("foo")
}
class x {
  notice("x")
  foo { 'x foo':
  }
}
class y {
  notice("y")
  foo { 'y foo':
  }
}
include x
include y

My problem starts when I need to parametrize class "foo::pre":

class foo::pre($blah) {
  notice("foo::pre")
}
define foo() {
  class { 'foo::pre':
    blah => 1,
  }
  notice("foo")
}
class x {
  notice("x")
  foo { 'x foo':
  }
}
class y {
  notice("y")
  foo { 'y foo':
  }
}
include x
include y

When I try to apply this code, I get the error "Duplicate definition:
Class[Foo::Pre] is already defined".

I always thought that the "class { 'someclass': }" syntax was
equivalent to "include someclass", but it seems that in the former,
Puppet treats it as a class definition and not just an include (even
though that's not where the class is defined).

Is there any way around this, or another way to achieve this with
parametrized classes?

Thanks in advance,
Andre

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