On 03/08/2011 10:09 PM, Disconnect wrote:
> class app {
>   exec { "prescript":
>     refreshonly => true, command => ..,
>   }
>   package { package1: ensure => installed, require => Exec["prescript"],
> notify => Exec["postscript"] }
>   package { package2: ensure => installed, require =>
> Package["package1"], notify => Exec["postscript"] }
>   # or require the exec if ordering doesn't matter
>   ..
>   exec { "postscript":
>     command => "post install",
>     refreshonly => true,
>   }
> }
>  
> Not 100% sure that the require will run the prescript, but I think that
> is correct. And the postscript will get run once at the end (even though
> it is notified 4 times)

Probably not, as the prescript isn't notified.

The prescript should not be refreshonly and specify a sensible "onlyif"
or "unless" check, so the original design is alright. (I'd use rpm -q if
possible.)

You can save reduncancy by merely adding
Package {
  require => Exec["bash prescript"],
  notify => Exec["bash postscript"]
}
to the original code.

HTH,
Felix

-- 
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.

Reply via email to