Hello I have some code that works like the simplified clase shown below. The idea is to have a define "foo" that includes a class "foo::pre" which contains resources that need to be executed before the define is called. The define can be called multiple times but the initialization has to be done only once, which is why it's implemented as a class:
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 The issue is that now I need to parametrize foo::pre so that its behavior depends on a variable that exists in foo: 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 With this code I get "Duplicate definition: Class[Foo::Pre] is already defined". This seems weird to me because I thought the "class { 'myclass': }" syntax was semantically equivalent to "include myclass". Puppet, however, complains that it's being defined twice, even though there's no definition happening there, just inclusion. So, is there a way to redesign this to match the original behavior? I know the current trend is to keep this kind of thing in hiera but this is already a fairly large code base that can't be changed quickly... Thanks in advance, Andre -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/dll5ilVD_60J. 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.