- From: Daniel DeLeo <
>
- To:
- Subject: [chef] Re: Re: Re: notifies :before
- Date: Thu, 21 Nov 2013 09:22:33 -0800
On Thursday, November 21, 2013 at 6:20 AM, Steven De Coeyer wrote:
Thank you for your reply. I understand how notifies work, I was just wondering if there was an elegant way to notify resources _before_ running current resource.
I know you could do it with chaining resources through notify, but that smells a bit.
I found an issue asking the same question:
This would certainly be useful. The canonical use case is if you’re managing a service that needs to be stopped before it’s upgraded, which is common for some kinds of web app.
Unfortunately, the way most Chef providers are written now, there’s no reasonable way to implement this as a before notification. One possible avenue we haven’t explored yet is to run an individual resource in why-run mode to see if it would make a change, which might look like this in the DSL:
service “my-web-app” do
action :stop
# means “only if the resource deploy[my-web-app] would make changes when running the :deploy action"
test_resource “deploy[my-web-app]”, :deploy
end
The implementation would still be pretty complicated, but much less so than the things we’ve tried before. Someone outside of opscode would need to take this on because I don’t think we can fit it in our priorities for quite a while.
--
Daniel DeLeo
Archive powered by MHonArc 2.6.16.