Hello all,First, I would like to thank you for your suggestion about an 'if/case' statement. I think that should do what I want. However, I would think that even if defines are scoped separately from classes, that wouldn't necessarily apply in the case that I outlined below since I used a different define name in the subclass as opposed to the name for the define in the parent class. I was trying to get a resource override into a define. Is that not possible; i.e., can defines only handle resource definitions, but not overrides?
Thanks. John Guthrie On 01/08/2010 03:29 PM, Trevor Vaughan wrote:
-------BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 So, I believe (someone please correct me if I'm wrong) that defines are actually separately scoped from the classes that contain them and cannot currently be overridden. The nesting that you have below is merely a convenience for writing: define test::myfile () { ... } I would suggest either using a template or an inline 'if/case' statement to apply the logic you require. Trevor On 01/08/2010 03:06 PM, John T. Guthrie wrote:Hello all, Suppose you have a resource that is created with a define such as the following: class test { define myfile () { file { "/tmp/$name": content => generate("/bin/echo","$name"); } } myfile { "foo": } } And it turns out that I want to create a subclass that overrides a property of "/tmp/foo", how would I go about doing that? When I try to add the following subclass: class test::override inherits test { define myfileover () { File["/tmp/$name"] { content => generate("/bin/echo","$name","$name") } } myfileover { "blah": } } I get the following error: Could not retrieve catalog: Only subclasses can override parameters at /etc/puppet/network/prod/modules/test/manifests/init.pp:20 on node xxxx. Does anyone have any suggestions? Thanks. John Guthrie
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet-us...@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.