[chef] Re: Re: Re: Email notification upon success or failure (with logs)


Chronological Thread 
  • From: Maven User < >
  • To:
  • Subject: [chef] Re: Re: Re: Email notification upon success or failure (with logs)
  • Date: Tue, 25 Oct 2011 13:27:08 -0400

So I'm following along with the exception and report handler example (http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers) and I have a couple of questions.

I've got the chef_handler configured in my recipe like this:

    chef_handler "MYLibs::Email" do
      source "C:/chef/handlers/Email.rb"
      arguments :from_address => " "> ", :to_address => " "> "
      action :enable
    end

This based on the initialization method in the Email class:

    def initialize(from_address, to_address)
      @from_address = from_address
      @to_address   = to_address
    end

But that results in:

[Tue, 25 Oct 2011 13:24:29 -0400] FATAL: ArgumentError: chef_handler[MYLibs::Email] (email_demo::default line /chef/cache/cookbooks/email_demo/recipes/default.rb) had an error: wrong number of arguments (1 for 2)

When I look at the json output, I can clearly see both defined:

        "arguments": {
          "to_address": " "> ",
          "from_address": " "> "
        },

Am I passing in the initialization arguments wrong?

On Tue, Oct 25, 2011 at 12:12 PM, Maven User < "> > wrote:
Hmmm - I don't see anything in the chef-client cookbook about handlers:

https://github.com/opscode/cookbooks/tree/master/chef-client/recipes

So if I pull down the chef_handler cookbook and add a new handler - don't I just depend on that in my recipe?


On Tue, Oct 25, 2011 at 11:57 AM, Andrea Campi < " target="_blank"> > wrote:


On Oct 25, 2011, at 5:44 PM, Daniel DeLeo < " target="_blank"> > wrote:

> On Tuesday, October 25, 2011 at 7:51 AM, Maven User wrote:
>> Looking over various available cookbooks, searching through the wiki and then good 'ol google - I didn't find a way to incorporate a mailing notification that didn't require additional software to be installed on the client manually.
>>
>> What is the typical approach for sending email notification when a chef-client run is complete?
>>
>> Are handlers really the only way?
> Yes, handlers are the only way at present. Server side notifications may be added in a future release of Chef, but there's nothing set in stone at the moment.

That said, it needn't be manual; look at the handlers recipe in the chef-client cookbook.





Archive powered by MHonArc 2.6.16.

§