On Fri, May 11, 2012 at 3:57 AM, Luke Bigum <luke.bi...@lmax.com> wrote: > Hello, > > Is it possible to override a resource that is created with the > create_resource function? > > This manifest does not compile: > > ------------------ > $hash = { 'msg' => { message => 'woof' } } > > class base { > create_resources('notify', $hash) > } > > class over inherits base { > Notify['msg'] { message => 'meow' } > } > > class { 'base': } > class { 'over': } > -----------------
You can't declare both classes, but you can override resources in class over, because we can merge hash values before calling create resource. The example here is obviously contrived, but I assume you have a bigger hash you want to merge. The merge function comes from stdlib: # don't inherit base we can create the resources here instead. class over { $local_setting = { 'msg' => { message => 'meow'} } $newhash = merge($local_setting, $hash) create_resource('notify', $newhash} } Thanks, Nan -- 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.