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'', ??? ], } } And the following constraints - The foo resource depends on oracle::server but it does also depend on ALL oracle::patch::XX classes - The patches I want to install on different nodes may vary so my problem is - I can modify the patch classes to also specifiy `before => instanceFoo, instanceBar` etc but this seems ugly - Setting require => Class[''oracle::patch::patchA'',''oracle::patch::patchB''] for all instances does also feel wrong. I tried to work around this with stages but I cannot assign a stage to oracle::instance because stages are just allowed at class level, not resource level. How would you solve the issue? I thought about one parameterized oracle::patch class that (based on a the parameters) includes the specific patch classes. Then at oracle::instance level I only have one require to this oracle::patch class. Or create an empty class as an anchor. All patches will then define before => Class[''empty_class''] and all instances define require => Class[''empty_class'']. Any best practices? -Stefan
On Wed, Mar 7, 2012 at 4:20 AM, Stefan Schulte <stefan.schulte@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'': } Also in this case feels like require oracle::server should be in oracle::instance so you don''t need to repeat it for every node.> And the following constraints > > - The foo resource depends on oracle::server but it does > also depend on ALL oracle::patch::XX classes > - The patches I want to install on different nodes may vary > > so my problem is > > - I can modify the patch classes to also specifiy `before => instanceFoo, > instanceBar` etc but this seems ugly > - Setting require => Class[''oracle::patch::patchA'',''oracle::patch::patchB''] > for all instances does also feel wrong. > > I tried to work around this with stages but I cannot assign a stage to > oracle::instance because stages are just allowed at class level, not > resource level. > > How would you solve the issue? I thought about one parameterized > oracle::patch class that (based on a the parameters) includes the > specific patch classes. Then at oracle::instance level I only have one > require to this oracle::patch class. Or create an empty class as an anchor. > All patches will then define before => Class[''empty_class''] and all instances > define require => Class[''empty_class''].If you need different parameters for each patch, maybe an anchor (in stdlib), and specify each patch class before Anchor[''oracle::patch'']. 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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.schulte@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? -Stefan
On Wed, Mar 7, 2012 at 12:15 PM, Stefan Schulte <stefan.schulte@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.schulte@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.