On Wed, Mar 7, 2012 at 12:15 PM, Stefan Schulte <stefan.schu...@taunusstein.net> wrote: > On Wed, Mar 07, 2012 at 08:15:54AM -0800, Nan Liu wrote: >> On Wed, Mar 7, 2012 at 4:20 AM, Stefan Schulte >> <stefan.schu...@taunusstein.net> wrote: >> > Hi, >> > >> > I have the following basic node definition >> > >> > node 'mynode' { >> > class { 'oracle::server': } >> > class { 'oracle::patch::patchA': >> > require => Class['oracle::server'], >> > } >> > class { 'oracle::patch::patchB': >> > require => Class['oracle::server'], >> > } >> > oracle::instance { 'foo': >> > require => [ 'oracle::server', ??? ], >> > } >> > } >> >> If you have no parameters for the patches: >> >> define oracle::load_patch { >> $subclass = "oracle::instance::$name" >> class { $subclass: >> require => Class['oracle::server'], >> } >> } >> >> oracle::load_patch { ['patchA','patchB']: >> before => Notify['end'], >> } >> >> notify { 'end': >> } >> > > Haven't thought of that one but the problem is now that I have multiple > oracle::instance resources and don't want to update the before > constraint in oracle::load_patch all the time. But the following might > work: > > # Wrapperclass around your load_patch resource as an anchor > class oracle::patch ( $patches = [] ){ > Class['oracle::server'] -> Class['oracle::patch'] > oracle::load_patch { $patches: > require => Class['oracle::server'], > } > } > > and in my node definition I would write > > class { 'oracle::server': } > class { 'oracle::patch': > patches => [ 'patchA', 'patchB' ], > } > oracle::instance { 'foo': > require => Class['oracle::patch'], > } > oracle::instance { 'bar': > require => Class['oracle::patch'], > } > > What do you think of this option?
Seems fine, and if you can update the oracle::patch class to handle empty list of patches, you can the move the require => Class['oracle::patch'] to the oracle::instance definition and simplify the node declaration even further. 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.