[chef] Re: RE: Re: Re: Notifications almost but not quite :immediate ?


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: RE: Re: Re: Notifications almost but not quite :immediate ?
  • Date: Mon, 23 Sep 2013 10:26:28 -0700

Title: RE: [chef] Re: Re: Notifications almost but not quite :immediate ?

On Monday, September 23, 2013 at 7:23 AM, Kevin Keane Subscription wrote:

On Sunday, September 22, 2013 at 9:22 AM, Kevin Keane Subscription wrote:

I'm wondering if there is a way to get notifications to be delayed slightly, without having to wait for the end of the run?

Here is the scenario: I add several Yum repositories using a recipe. After the repositories are added, I need to rebuild the Yum cache.

I have two options to do that:

- Send a delayed notification - but then other recipes don't get the benefit of the new repositories until the next run, and thus may break.

- Send an immediate notification - but then the cache gets rebuilt multiple times. Rebuilding the Yum cache is very expensive in terms of time and bandwidth, so I want to avoid that.

Is there a trick I can use to only cause one notification to be sent after all of the repositories have been added?

Thanks!


There's nothing built-in to do what you want, but it should be possible as an LWRP:

Using the #resources method, you can get a reference to a resource by its name: http://docs.opscode.com/dsl_recipe_method_resources.html Or you can access the resource collection via the run_context (e.g. `run_context.resource_collection`) and then look through each item: https://github.com/opscode/chef/blob/master/lib/chef/resource_collection.rb

Using this, you can find all the resources you're interested in, and check if they're updated with Resouce#updated?, which would then take the desired action.

-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§