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?

-Stefan

Attachment: pgpIE1abHksEV.pgp
Description: PGP signature

Reply via email to