SNS Handler Cookbook

I’ve tried a number of times to get chef handlers to work. Failed each
time. Thought I’d give it another shot.

Started with this: http://onddo.github.io/chef-handler-sns/

You can load the handler in the client.rb file so that it catches errors
during the convergence phase. However, after installing the stated
dependancies manually, and adding the necessary bits to the client.rb file,
nothing seems to happen after a chef-client run. I can’t see anything
indicating anything happens in the client.log file.

The document says:

“We recommend using the chef_handler_sns cookbook for easy installation.”

Well, if I use a cookbook to install it, how’s it going to catch any errors
during the convergence phase on the initial chef-client run? Will using the
cookbook allow it to catch errors during the convergence phase os
subsequent chef-client runs?

Doug.

I think some of your questions are address here
About Handlers, but the short version is that you
register the handler very early on, and then it executes at the end of
the Chef run.

There is always a chance for failure before the handler is registered, so
you generally want to do those very early on in your run_list.

I'm not sure you will see any output from an exception handler if there are
no errors, but a good way to test this would be to enable this handler:
GitHub - jtimberman/chef-handler-updated-resources: Simple Report Handler of Updated Resources. That will
produce visible output of which resources were changed during your Chef run
(while at the same time proving you registered a handler)

On Wed, Sep 23, 2015 at 12:37 PM, Doug Garstang doug@slice.com wrote:

I've tried a number of times to get chef handlers to work. Failed each
time. Thought I'd give it another shot.

Started with this: Chef-handler-sns by onddo

You can load the handler in the client.rb file so that it catches errors
during the convergence phase. However, after installing the stated
dependancies manually, and adding the necessary bits to the client.rb file,
nothing seems to happen after a chef-client run. I can't see anything
indicating anything happens in the client.log file.

The document says:

"We recommend using the chef_handler_sns cookbook for easy installation."

Well, if I use a cookbook to install it, how's it going to catch any
errors during the convergence phase on the initial chef-client run? Will
using the cookbook allow it to catch errors during the convergence phase os
subsequent chef-client runs?

Doug.

Thanks David. I'm going to have to dump it yet again. Nokogiri, which is a
dependency of the sns handler cookbook fails to build.

NoMethodError

chef_gem[chef-handler-sns]
(/var/chef/cache/cookbooks/chef_handler_sns/providers/default.rb line 93)
had an error: NoMethodError: undefined method `full_name' for nil:NilClass

Douglas.

On Wed, Sep 23, 2015 at 9:47 AM, David Petzel davidpetzel@gmail.com wrote:

I think some of your questions are address here
About Handlers, but the short version is that you
register the handler very early on, and then it executes at the end of
the Chef run.

There is always a chance for failure before the handler is registered, so
you generally want to do those very early on in your run_list.

I'm not sure you will see any output from an exception handler if there
are no errors, but a good way to test this would be to enable this handler:
GitHub - jtimberman/chef-handler-updated-resources: Simple Report Handler of Updated Resources. That will
produce visible output of which resources were changed during your Chef run
(while at the same time proving you registered a handler)

On Wed, Sep 23, 2015 at 12:37 PM, Doug Garstang doug@slice.com wrote:

I've tried a number of times to get chef handlers to work. Failed each
time. Thought I'd give it another shot.

Started with this: Chef-handler-sns by onddo

You can load the handler in the client.rb file so that it catches errors
during the convergence phase. However, after installing the stated
dependancies manually, and adding the necessary bits to the client.rb file,
nothing seems to happen after a chef-client run. I can't see anything
indicating anything happens in the client.log file.

The document says:

"We recommend using the chef_handler_sns cookbook for easy installation."

Well, if I use a cookbook to install it, how's it going to catch any
errors during the convergence phase on the initial chef-client run? Will
using the cookbook allow it to catch errors during the convergence phase os
subsequent chef-client runs?

Doug.

Hi Doug,

On 2015-09-23 09:37, Doug Garstang wrote:

Well, if I use a cookbook to install it, how's it going to catch any errors
during the convergence phase on the initial chef-client run? Will using the
cookbook allow it to catch errors during the convergence phase os
subsequent chef-client runs?

No, IIRC the cookbook does not catch convergence phase errors. The cookbook is
to install the gem and its dependencies easily. Then calls the chef_handler
resource with all its limitations:

It's pretty simple.

Nokogiri, which is a dependency of the sns handler cookbook fails to build.

NoMethodError

chef_gem[chef-handler-sns]
(/var/chef/cache/cookbooks/chef_handler_sns/providers/default.rb line 93)
had an error: NoMethodError: undefined method `full_name' for nil:NilClass

Please, open an issue here with all the information you can provide:

I will try to have a look at it ASAP.

Regards,

--
Xabier de Zuazo

Xabier,

My understanding from the docs at GitHub - zuazo/chef-handler-sns: Chef report handler to send Amazon SNS notifications on failures or changes.
is that if you install the cookbook, as long as you put the relevant
sections in the client.rb file, then it should catch errors during the
convergence phase:

"This method will not catch errors before the convergence phase"

That won't cover convergence errors on the very first run, after my
bootstrap process adds the correct pieces to the client.rb file, but before
the cookbook installs all the dependancies for the very first time. Correct?

Doug.

On Wed, Sep 23, 2015 at 11:18 AM, Xabier de Zuazo xabier@zuazo.org wrote:

Hi Doug,

On 2015-09-23 09:37, Doug Garstang wrote:

Well, if I use a cookbook to install it, how's it going to catch any
errors
during the convergence phase on the initial chef-client run? Will using
the
cookbook allow it to catch errors during the convergence phase os
subsequent chef-client runs?

No, IIRC the cookbook does not catch convergence phase errors. The
cookbook is
to install the gem and its dependencies easily. Then calls the
chef_handler
resource with all its limitations:

GitHub - chef-boneyard/chef_handler: DEPRECATED: Development repository for Chef Cookbook chef_handler

It's pretty simple.

Nokogiri, which is a dependency of the sns handler cookbook fails to
build.

NoMethodError

chef_gem[chef-handler-sns]
(/var/chef/cache/cookbooks/chef_handler_sns/providers/default.rb line 93)
had an error: NoMethodError: undefined method `full_name' for
nil:NilClass

Please, open an issue here with all the information you can provide:

Sign in to GitHub · GitHub

I will try to have a look at it ASAP.

Regards,

--
Xabier de Zuazo

Hi Doug,

On 2015-09-23 11:55, Doug Garstang wrote:

My understanding from the docs at GitHub - zuazo/chef-handler-sns: Chef report handler to send Amazon SNS notifications on failures or changes.
is that if you install the cookbook, as long as you put the relevant
sections in the client.rb file, then it should catch errors during the
convergence phase:

"This method will not catch errors before the convergence phase"

That won't cover convergence errors on the very first run, after my
bootstrap process adds the correct pieces to the client.rb file, but before
the cookbook installs all the dependancies for the very first time. Correct?

That's right. But you need to add that code to the client.rb yourself.

I think you left out the end of my reply:

On 2015-09-23 20:18, Xabier de Zuazo wrote:

Please, open an issue here with all the information you can provide:

Sign in to GitHub · GitHub

I will try to have a look at it ASAP.

--
Xabier de Zuazo