Force restart/start


#1

Hi chefs :slight_smile:

Another best practice request:

Some cookbook recipes are designed for a generic case. I would like to have as less changes to them as possible.
At the moment I’m thinking about the problem of start/restart actions.

lets say we use a recipe to install/configure a service. during converge it gets a action start or restart and
does that with a delayed notification. fine.

now I know that I have a dependency on that service and want to ensure that (e.g. in the very last recipe on that node)
the service receives a :restart :immediately but does pop the whatever :restart/:start from its delayed actions.

How would I implement that?

cu edi

DI Edmund Haselwanter, edmund@haselwanter.com, http://edmund.haselwanter.com/
http://www.iteh.at | http://facebook.com/iTeh.solutions | http://at.linkedin.com/in/haselwanteredmund


#2

If I’m interpreting your question correctly - just yesterday we added an
FAQ[1] on this very topic :slight_smile: Check that out and see if it responds to what
you are seeking…

On Fri, May 13, 2011 at 12:37 AM, Haselwanter Edmund <edmund@haselwanter.com

wrote:

Hi chefs :slight_smile:

Another best practice request:

Some cookbook recipes are designed for a generic case. I would like to have
as less changes to them as possible.
At the moment I’m thinking about the problem of start/restart actions.

lets say we use a recipe to install/configure a service. during converge it
gets a action start or restart and
does that with a delayed notification. fine.

now I know that I have a dependency on that service and want to ensure that
(e.g. in the very last recipe on that node)
the service receives a :restart :immediately but does pop the whatever
:restart/:start from its delayed actions.

How would I implement that?

cu edi

DI Edmund Haselwanter, edmund@haselwanter.com,
http://edmund.haselwanter.com/
http://www.iteh.at | http://facebook.com/iTeh.solutions |
http://at.linkedin.com/in/haselwanteredmund


#3

On 13.05.2011, at 16:23, Tom Thomas wrote:

If I’m interpreting your question correctly - just yesterday we added an FAQ[1] on this very topic :slight_smile: Check that out and see if it responds to what you are seeking…

No. What I want to do is inspect the notifications for a service and act on that. in pseudocode

notifications.delete_if do |notification|
notification.service_name == service_name && [:start,:restart].contains(notification.action)
end

service service_name
action :restart, :immediately
end

so that this immediately action is executed once and not twice (at the very end through the notification)

cu edi

  • Tom

[1] http://wiki.opscode.com/display/chef/Troubleshooting+and+Technical+FAQ#TroubleshootingandTechnicalFAQ-HowcanIensurethatmyrecipeprocesses%2Cregardlessofthefullrunofchefclientcompleting%3F

On Fri, May 13, 2011 at 12:37 AM, Haselwanter Edmund edmund@haselwanter.com wrote:
Hi chefs :slight_smile:

Another best practice request:

Some cookbook recipes are designed for a generic case. I would like to have as less changes to them as possible.
At the moment I’m thinking about the problem of start/restart actions.

lets say we use a recipe to install/configure a service. during converge it gets a action start or restart and
does that with a delayed notification. fine.

now I know that I have a dependency on that service and want to ensure that (e.g. in the very last recipe on that node)
the service receives a :restart :immediately but does pop the whatever :restart/:start from its delayed actions.

How would I implement that?

cu edi

DI Edmund Haselwanter, edmund@haselwanter.com, http://edmund.haselwanter.com/
http://www.iteh.at | http://facebook.com/iTeh.solutions | http://at.linkedin.com/in/haselwanteredmund


DI Edmund Haselwanter, edmund@haselwanter.com, http://edmund.haselwanter.com/
http://www.iteh.at | http://facebook.com/iTeh.solutions | http://at.linkedin.com/in/haselwanteredmund