[chef] Re: Re: Re: Re: Re: Re: Re: Re: CHEF-3930: Run apt-get update automagically if apt-get install fails


Chronological Thread 
  • From: Jesse Campbell < >
  • To: chef < >
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Re: Re: CHEF-3930: Run apt-get update automagically if apt-get install fails
  • Date: Mon, 4 Mar 2013 14:09:39 -0500

I like this concept too, and add Bryan's point about knowing what triggered it, something like this (sorry, a good bit of pseudo code here)

package "totally-sucks-devel"

on_failure "run apt-get update" do
  match /^package/
  block do              <------- optional, is passed a failed_resource object
    puts "#{failed_resource.name} triggered this error!"
    if failed_resource.name != "totally-sucks-devel"
      raise
    end
  end
end


On Mon, Mar 4, 2013 at 1:54 PM, Andrew Gross < " target="_blank"> > wrote:
What would be a good way to prevent it from running in all cases?

only_if? not_if?  Some provider specific parameter?

package "must-be-version-locked" do
 version "foo"
end

package "totally-sucks-devel"

on_failure "run apt-get update" do
  match /^package/
  no_match /version/
  notifies :run, "execute[apt-get-update]"
end

I like the concept, should be careful to set it up in a way that doesn't cause unexpected side effects, especially when including things from dependencies. Would it be possible to scope it to the calling cookbook?


On Mon, Mar 4, 2013 at 1:29 PM, Greg Symons < " target="_blank"> > wrote:
Oooh... that looks yummy. I like the idea of being able to stop a service if a later resource (say something being deployed) fails.

Greg


On 03/04/2013 11:13 AM, Adam Jacob wrote:
Why don't we make this a resource?

package "totally-sucks-devel"

on_failure "run apt-get update" do
   match /^package/
   notifies :run, "execute[apt-get-update]"
end

Where match is a regular _expression_ that looks for names of resources.

Adam

On 3/4/13 9:06 AM, "Bryan McLellan" < " target="_blank"> > wrote:

On Fri, Mar 1, 2013 at 11:21 PM, Jesse Campbell < " target="_blank"> > wrote:
What about extending the current handler approach? Add the ability to
catch
a failed resource (by name) and retry it, just like you can with a
begin/rescue.
I like the concept of having an exception handler be tied to a
resource or provider, or at least be able to determine what resource
or provider caused the exception, do some bits and retry.

Bryan








Archive powered by MHonArc 2.6.16.

§