[chef] Re: Re: Using notify to run a recipe


Chronological Thread 
  • From: Tom < >
  • To:
  • Subject: [chef] Re: Re: Using notify to run a recipe
  • Date: Tue, 28 Aug 2012 20:06:19 +0100

In the end I have solved this one by doing the following in a recipe:

node.role.packages.singlenode.each do |pkg|
  p = package "#{pkghost}-#{pkg}" do
    action :nothing
  end
  p.run_action(:upgrade)
  if p.updated_by_last_action?
    include_recipe "install::single-node"
  end
end

Which runs the recipe post install, and works against an array of packages. I would like to find a way to pre-install too, but this works for now.

Tom


On 28 August 2012 17:09, Ranjib Dey < " target="_blank"> > wrote:
what does recipe[pre_inst] do? Is there any particular reason you can not include pre_inst (or vice versa) and notify specific resources from pre_inst? Given that you can have multiple notification there may be a cleaner solution.

 
On Tue, Aug 28, 2012 at 9:35 PM, Tom < " target="_blank"> > wrote:
Hi,

Is it possible to make a resource notify, (and thus run) an entire recipe.

For example:
  I wish to upgrade a package, but it depends on certain resources being executed - either before or after the package installation.

Is it possible to do something like:

package "application" do
  action :upgrade
  notifies recipe[pre_inst]
end

?

thanks





Archive powered by MHonArc 2.6.16.

§