[chef] Re: Iterating through parameters when a resource is retried


Chronological Thread 
  • From: Brian Hatfield < >
  • To:
  • Subject: [chef] Re: Iterating through parameters when a resource is retried
  • Date: Mon, 14 Jan 2013 12:38:03 -0500

I wanted to bump this thread because I realized a more succinct way to ask my question:

Is there a way to cleanly handle the failure of a resource or a set of resources such that I can then perform some 'graceful degradation' action? (IE; 'begin...rescue' in regular ruby parlance, but that does not apply here)

Thank you!
Brian


On Fri, Jan 11, 2013 at 4:36 PM, Brian Hatfield < " target="_blank"> > wrote:
Given a resource like the following:

apt_repository "global-generic" do
    uri "SOMEURI"
    distribution "SOMEDISTRO"
    keyserver key_server
    key apt_key
    retries 2
end

it will retry if for example the keyserver is not reachable. For whatever reason, we are finding that large number of keyservers are not long-term reliable, or we are getting blocked, or something, but our keyserver requests time out.

What I would like to do is make keyserver be a list, and if the first item on the list fails, iterate to the second and so-on.

However, when I try this (ie, key_servers.pop), in practice it pops one item off the list and retries that item over and over rather than 'pop'ing a new item on each retry. I get that this is because of the way that convergence and such occurs, but is there any way for me to retry with different values?

Thank you!
Brian Hatfield




Archive powered by MHonArc 2.6.16.

§