Chef Failure and Lost Notifications

I have been seeing this problem in my cookbooks where a recipe updates some
config and attempts to restart a service by sending a ‘delayed’ notification to
the service resource but another cookbook/recipe later in the run list fails.
The restart notification is never executed and during the next chef run the
config is correct and so the service is never restarted and config is never
reloaded.

The simple solution to this is to always use the :immediately tag, but then you
may end up restarting your service several times during a chef run.

Another option is to create a node on that machine for each recipe that starts
a service, but this seems like an administration pain.

Any thoughts?

This topic has come up here before. There's also a ticket
http://tickets.opscode.com/browse/CHEF-1067

What we need is an option to force a notify or make it sticky, even when
the chef run fails.

On Tue, Apr 3, 2012 at 11:42 AM, bjbq4d@gmail.com wrote:

I have been seeing this problem in my cookbooks where a recipe updates some
config and attempts to restart a service by sending a 'delayed'
notification to
the service resource but another cookbook/recipe later in the run list
fails.
The restart notification is never executed and during the next chef run the
config is correct and so the service is never restarted and config is never
reloaded.

The simple solution to this is to always use the :immediately tag, but
then you
may end up restarting your service several times during a chef run.

Another option is to create a node on that machine for each recipe that
starts
a service, but this seems like an administration pain.

Any thoughts?

Reminds me of 'ensure' in ruby.

Bryan
On Apr 3, 2012 2:52 PM, bjbq4d@gmail.com wrote:

I have been seeing this problem in my cookbooks where a recipe updates some
config and attempts to restart a service by sending a 'delayed'
notification to
the service resource but another cookbook/recipe later in the run list
fails.
The restart notification is never executed and during the next chef run the
config is correct and so the service is never restarted and config is never
reloaded.

The simple solution to this is to always use the :immediately tag, but
then you
may end up restarting your service several times during a chef run.

Another option is to create a node on that machine for each recipe that
starts
a service, but this seems like an administration pain.

Any thoughts?

I vote for this. Sometimes it's required.

2012/4/7 Peter Struijk peter@delftblues.net

This topic has come up here before. There's also a ticket
http://tickets.opscode.com/browse/CHEF-1067

What we need is an option to force a notify or make it sticky, even when
the chef run fails.

On Tue, Apr 3, 2012 at 11:42 AM, bjbq4d@gmail.com wrote:

I have been seeing this problem in my cookbooks where a recipe updates
some
config and attempts to restart a service by sending a 'delayed'
notification to
the service resource but another cookbook/recipe later in the run list
fails.
The restart notification is never executed and during the next chef run
the
config is correct and so the service is never restarted and config is
never
reloaded.

The simple solution to this is to always use the :immediately tag, but
then you
may end up restarting your service several times during a chef run.

Another option is to create a node on that machine for each recipe that
starts
a service, but this seems like an administration pain.

Any thoughts?