- From: Jesse Campbell <
>
- To: chef <
>
- Subject: [chef] notifying one resource from a provider
- Date: Tue, 12 Nov 2013 15:22:09 -0500
For one of my projects, I need to be able to tell the deploy resource how to restart a service.
Currently, I do it like this:
unless new_resource.restart_command
new_resource.restart_command do
run_context.resource_collection.find(:service => "tomcat6").run_action(:restart)
end
end
the trouble with this approach is that tomcat6 gets restarted immediately when deploy triggers a restart. Instead, I want deploy to "notify" tomcat6 to restart at the end of the chef run.
what function can be called to add something to the notification stack?
I'm thinking something like this, but no idea if it would work?
unless new_resource.restart_command
new_resource.restart_command do
run_context.notifies_delayed(Chef::Resource::Notification.new(:service => "tomcat6", :restart, self))
end
end
Thanks!
- [chef] notifying one resource from a provider, Jesse Campbell, 11/12/2013
Archive powered by MHonArc 2.6.16.