- From: Peter Donald <
- Subject: [chef] Re: Re: Re: Re: RE: Re: Re: Re: Re: Re: CHEF-3930: Run apt-get update automagically if apt-get install fails
- Date: Tue, 5 Mar 2013 08:58:18 +1100
On Tue, Mar 5, 2013 at 7:44 AM, Andrew Gross
> That works pretty well, I think the previous idea sprouted from the
> constraint that we didnt want to have to add this block to every single
> package block. Unsure how to resolve that with this syntax unless we could
> specify global defaults for some of these things.
I would not classify it as setting of defaults but would look at it
from a different angle. In some scenarios you want/need to handle
cross-cutting concerns consistently across the compiled resource base.
Typically rules may be;
* Use a single maven repository, regardless of what the recipe says
when downloading artifacts
* Retry once on failure to download artifacts
* Use a single apt repository, regardless of what the recipe says when
* Retry twice on failure to download packages
In the development world these are typically described as aspects and
many different systems have converged on using interceptor driven
approach to implement this. However, I prottyped it a hacky way after
I saw chef-rewind by adding something like the following to a recipe
at the end of a run.
@run_context.resource_collection.each do |r|
r.some_var = 'mydefault' if r.is_a?(MyResource)
Archive powered by MHonArc 2.6.16.