# Installing handlers with chef\_handler

**URL:** <https://discourse.chef.io/t/installing-handlers-with-chef-handler/1936>\
**Category:** Chef Infra (archive)\
**Created:** [July 21, 2011, 2:38pm UTC](https://discourse.chef.io/t/installing-handlers-with-chef-handler/1936 "2011-07-21T14:38:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zts](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/zts/32/111_2.png) [@zts](https://discourse.chef.io/u/zts)\
**Post date:** [July 21, 2011, 2:38pm UTC](https://discourse.chef.io/t/installing-handlers-with-chef-handler/1936/1 "2011-07-21T14:38:08Z")

</div>

Hiya,

I would like to write a simple chef report handler, to distribute it  
to my chef clients, and to get chef-client to use it.

The documentation  
([http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers](http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers))  
points out the chef\_handler cookbook, which exists to distribute and  
install handlers. That’s exactly what I want to do, but I can’t get  
it to work.

jtimberman blogged a very simple report handler example:  
[http://jtimberman.posterous.com/a-simple-report-handler](http://jtimberman.posterous.com/a-simple-report-handler)

I added this to my fork of the chef\_handler repo  
([https://github.com/zts/chef\_handler/](https://github.com/zts/chef_handler/)) and made sure that  
recipe[chef\_handler] would distribute the file - which it did. I then  
configured /etc/chef/client.rb per the blog, and confirmed that the  
handler worked:  
\<–snip–\>  
[Thu, 21 Jul 2011 15:14:52 +0100] INFO: Running report handlers  
[Thu, 21 Jul 2011 15:14:52 +0100] INFO: Resources updated this run:  
[Thu, 21 Jul 2011 15:14:52 +0100] INFO: remote\_directory[/var/chef/handlers]  
[Thu, 21 Jul 2011 15:14:52 +0100] INFO: Report handlers complete

However, I’d prefer not to be editing client.rb when the chef\_handler  
cookbook has a provider for this purpose.  
I reverted the changes to client.rb, and added a recipe -  
chef\_handler::updated\_resources. It looks like this:  
chef\_handler “SimpleReport::UpdatedResources” do  
Chef::Log.info "Loading handler from:  
#{node[‘chef\_handler’][‘handler\_path’]}/updated\_resources.rb"  
source "#{node[‘chef\_handler’][‘handler\_path’]}/updated\_resources.rb"  
action :nothing  
end.run\_action(:enable)

Then set it as my run\_list:  
$ knife node show kakistos.local -a run\_list  
run\_list: recipe[chef\_handler::updated\_resources]

Unfortunately, it blows up:  
[Thu, 21 Jul 2011 15:19:24 +0100] INFO: Loading handler from:  
/var/chef/handlers/updated\_resources.rb  
[Thu, 21 Jul 2011 15:19:24 +0100] INFO: Processing  
chef\_handler[SimpleReport::UpdatedResources] action enable  
(chef\_handler::updated\_resources line 4)  
[Thu, 21 Jul 2011 15:19:24 +0100] ERROR:  
chef\_handler[SimpleReport::UpdatedResources]  
(chef\_handler::updated\_resources line 4) has had an error

And the stacktrace:  
NameError: chef\_handler[SimpleReport::UpdatedResources]  
(chef\_handler::updated\_resources line 4) had an error: uninitialized  
constant Kernel::SimpleReport  
/var/chef/cache/cookbooks/chef\_handler/providers/default.rb:22:in `const_get' /var/chef/cache/cookbooks/chef_handler/providers/default.rb:22:in`block (2 levels) in class\_from\_file’  
/var/chef/cache/cookbooks/chef\_handler/providers/default.rb:22:in `each' /var/chef/cache/cookbooks/chef_handler/providers/default.rb:22:in`inject’  
/var/chef/cache/cookbooks/chef\_handler/providers/default.rb:22:in  
`block in class_from_file' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/provider.rb:104:in`instance\_eval’  
/Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/provider.rb:104:in  
`block in action' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/resource.rb:417:in`run\_action’  
/var/chef/cache/cookbooks/chef\_handler/recipes/updated\_resources.rb:8:in  
`from_file' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/mixin/from_file.rb:30:in`instance\_eval’  
/Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/mixin/from\_file.rb:30:in  
`from_file' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/cookbook_version.rb:578:in`load\_recipe’  
/Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/mixin/language\_include\_recipe.rb:40:in  
`block in include_recipe' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/mixin/language_include_recipe.rb:27:in`each’  
/Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/mixin/language\_include\_recipe.rb:27:in  
`include_recipe' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/run_context.rb:72:in`block in load’  
/Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/run\_context.rb:69:in  
`each' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/run_context.rb:69:in`load’  
/Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/client.rb:195:in  
`setup_run_context' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/client.rb:159:in`run’  
/Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/application/client.rb:239:in  
`block in run_application' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/application/client.rb:229:in`loop’  
/Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/application/client.rb:229:in  
`run_application' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/application.rb:66:in`run’  
/Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/bin/chef-client:26:in  
`<top (required)>' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/bin/chef-client:19:in`load’  
/Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/bin/chef-client:19:in `’

Questions:

- Have I made a mistake, or am I hitting a bug?
- Am I going about this the right way?

Undeterred, and assuming that perhaps that would be an obvious fault  
to someone more familiar with ruby, I changed tack and tried the  
chef\_handler::json\_file recipe. This is documented as enabling the  
JsonFile report handler which is bundled with chef. While it doesn’t  
explode, it doesn’t appear to do anything either:  
[Thu, 21 Jul 2011 14:55:35 +0100] INFO: Run List expands to  
[chef\_handler::json\_file]  
[Thu, 21 Jul 2011 14:55:35 +0100] INFO: Starting Chef Run for kakistos.local  
[Thu, 21 Jul 2011 14:55:37 +0100] INFO: Loading cookbooks [chef\_handler]  
[Thu, 21 Jul 2011 14:55:37 +0100] INFO: Processing  
chef\_handler[Chef::Handler::JsonFile] action enable  
(chef\_handler::json\_file line 24)  
[Thu, 21 Jul 2011 14:55:37 +0100] INFO: Processing  
chef\_handler[Chef::Handler::JsonFile] action nothing  
(chef\_handler::json\_file line 24)  
[Thu, 21 Jul 2011 14:55:40 +0100] INFO: Chef Run complete in 4.402447 seconds  
[Thu, 21 Jul 2011 14:55:40 +0100] INFO: Running report handlers  
[Thu, 21 Jul 2011 14:55:40 +0100] INFO: Report handlers complete

The relevant chunk of the debug output:  
[Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Loading cookbook  
chef\_handler’s providers from  
/var/chef/cache/cookbooks/chef\_handler/providers/default.rb  
[Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Loaded contents of  
/var/chef/cache/cookbooks/chef\_handler/providers/default.rb into a  
provider named chef\_handler defined in Chef::Provider::ChefHandler  
[Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Loading cookbook  
chef\_handler’s resources from  
/var/chef/cache/cookbooks/chef\_handler/resources/default.rb  
[Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Loaded contents of  
/var/chef/cache/cookbooks/chef\_handler/resources/default.rb into a  
resource named chef\_handler defined in Chef::Resource::ChefHandler  
[Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Node kakistos.local loading  
cookbook chef\_handler’s attribute file  
/var/chef/cache/cookbooks/chef\_handler/attributes/default.rb  
[Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Loading Recipe  
chef\_handler::json\_file via include\_recipe  
[Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Found recipe json\_file in  
cookbook chef\_handler  
[Thu, 21 Jul 2011 14:58:46 +0100] INFO: Processing  
chef\_handler[Chef::Handler::JsonFile] action enable  
(chef\_handler::json\_file line 24)  
[Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Chef::Handler::JsonFile has  
not been loaded  
[Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Converging node kakistos.local  
[Thu, 21 Jul 2011 14:58:46 +0100] INFO: Processing  
chef\_handler[Chef::Handler::JsonFile] action nothing  
(chef\_handler::json\_file line 24)  
[Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Doing nothing for  
chef\_handler[Chef::Handler::JsonFile]

Questions:

- Should this have done something?
- How should I approach debugging this issue? (I’m really not sure  
where to start)

All examples above are 0.10.2, on OS X, installed from gems. I’ve  
also tried to get this working on an ubuntu VM, but met with exactly  
the same results.

Thanks,

Zac

---

<div class="post-metadata">

**Author:** ![Seth\_Chisamore](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/seth_chisamore/32/488_2.png) [@Seth\_Chisamore](https://discourse.chef.io/u/Seth_Chisamore)\
**Post date:** [July 21, 2011, 4:01pm UTC](https://discourse.chef.io/t/installing-handlers-with-chef-handler/1936/2 "2011-07-21T16:01:05Z")

</div>

Zac,  
You may have stumbled across a bug. I will try to recreate and open a COOK ticket if appropriate.

The JsonFile handler should drop a JSON file in '/var/chef/reports' when it fires.

Also, we recommend you get cookbooks from the community site using 'knife cookbook site install' or 'knife cookbook site download'. The repository you forked, [Multiple vendor Chef cookbooks. · GitHub](http://github.com/cookbooks) is not an Opscode account, and we don't know what the state of the cookbooks in that repository might be. Opscode maintains the GitHub repository for development tracking, but not for released versions of cookbooks we can support. We push the released versions to [community.opscode.com](http://community.opscode.com). For more information see.

Seth

--  
Opscode, Inc.  
Seth Chisamore, Senior Technical Evangelist  
IRC, Skype, Twitter, Github: schisamo

[0] [Future of Opscode Cookbooks - Chef Blog | Chef](http://www.opscode.com/blog/2011/05/05/future-of-opscode-cookbooks/)

On Thursday, July 21, 2011 at 10:38 AM, Zac Stevens wrote:

> Hiya,
> 
> I would like to write a simple chef report handler, to distribute it  
> to my chef clients, and to get chef-client to use it.
> 
> The documentation  
> ([http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers](http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers))  
> points out the chef\_handler cookbook, which exists to distribute and  
> install handlers. That's exactly what I want to do, but I can't get  
> it to work.
> 
> jtimberman blogged a very simple report handler example:  
> [http://jtimberman.posterous.com/a-simple-report-handler](http://jtimberman.posterous.com/a-simple-report-handler)
> 
> I added this to my fork of the chef\_handler repo  
> ([GitHub - zts/chef\_handler: A Chef cookbook for chef\_handler](https://github.com/zts/chef_handler/)) and made sure that  
> recipe[chef\_handler] would distribute the file - which it did. I then  
> configured /etc/chef/client.rb per the blog, and confirmed that the  
> handler worked:  
> \<--snip--\>  
> [Thu, 21 Jul 2011 15:14:52 +0100] INFO: Running report handlers  
> [Thu, 21 Jul 2011 15:14:52 +0100] INFO: Resources updated this run:  
> [Thu, 21 Jul 2011 15:14:52 +0100] INFO: remote\_directory[/var/chef/handlers]  
> [Thu, 21 Jul 2011 15:14:52 +0100] INFO: Report handlers complete
> 
> However, I'd prefer not to be editing client.rb when the chef\_handler  
> cookbook has a provider for this purpose.  
> I reverted the changes to client.rb, and added a recipe -  
> chef\_handler::updated\_resources. It looks like this:  
> chef\_handler "SimpleReport::UpdatedResources" do  
> Chef::Log.info ([http://Log.info](http://Log.info)) "Loading handler from:  
> #{node['chef\_handler']['handler\_path']}/updated\_resources.rb"  
> source "#{node['chef\_handler']['handler\_path']}/updated\_resources.rb"  
> action :nothing  
> end.run\_action(:enable)
> 
> Then set it as my run\_list:  
> $ knife node show kakistos.local -a run\_list  
> run\_list: recipe[chef\_handler::updated\_resources]
> 
> Unfortunately, it blows up:  
> [Thu, 21 Jul 2011 15:19:24 +0100] INFO: Loading handler from:  
> /var/chef/handlers/updated\_resources.rb  
> [Thu, 21 Jul 2011 15:19:24 +0100] INFO: Processing  
> chef\_handler[SimpleReport::UpdatedResources] action enable  
> (chef\_handler::updated\_resources line 4)  
> [Thu, 21 Jul 2011 15:19:24 +0100] ERROR:  
> chef\_handler[SimpleReport::UpdatedResources]  
> (chef\_handler::updated\_resources line 4) has had an error
> 
> And the stacktrace:  
> NameError: chef\_handler[SimpleReport::UpdatedResources]  
> (chef\_handler::updated\_resources line 4) had an error: uninitialized  
> constant Kernel::SimpleReport  
> /var/chef/cache/cookbooks/chef\_handler/providers/default.rb:22:in `const_get' /var/chef/cache/cookbooks/chef_handler/providers/default.rb:22:in `block (2 levels) in class\_from\_file'  
> /var/chef/cache/cookbooks/chef\_handler/providers/default.rb:22:in `each' /var/chef/cache/cookbooks/chef_handler/providers/default.rb:22:in `inject'  
> /var/chef/cache/cookbooks/chef\_handler/providers/default.rb:22:in  
> `block in class_from_file' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/provider.rb:104:in `instance\_eval'  
> /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/provider.rb:104:in  
> `block in action' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/resource.rb:417:in `run\_action'  
> /var/chef/cache/cookbooks/chef\_handler/recipes/updated\_resources.rb:8:in  
> `from_file' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/mixin/from_file.rb:30:in `instance\_eval'  
> /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/mixin/from\_file.rb:30:in  
> `from_file' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/cookbook_version.rb:578:in `load\_recipe'  
> /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/mixin/language\_include\_recipe.rb:40:in  
> `block in include_recipe' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/mixin/language_include_recipe.rb:27:in `each'  
> /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/mixin/language\_include\_recipe.rb:27:in  
> `include_recipe' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/run_context.rb:72:in `block in load'  
> /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/run\_context.rb:69:in  
> `each' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/run_context.rb:69:in `load'  
> /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/client.rb:195:in  
> `setup_run_context' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/client.rb:159:in `run'  
> /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/application/client.rb:239:in  
> `block in run_application' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/application/client.rb:229:in `loop'  
> /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/application/client.rb:229:in  
> `run_application' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/lib/chef/application.rb:66:in `run'  
> /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/gems/chef-0.10.2/bin/chef-client:26:in  
> `<top (required)>' /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/bin/chef-client:19:in `load'  
> /Users/zts/.rvm/gems/ruby-1.9.2-p180@chef/bin/chef-client:19:in `'
> 
> Questions:
> 
> - Have I made a mistake, or am I hitting a bug?
> - Am I going about this the right way?
> 
> Undeterred, and assuming that perhaps that would be an obvious fault  
> to someone more familiar with ruby, I changed tack and tried the  
> chef\_handler::json\_file recipe. This is documented as enabling the  
> JsonFile report handler which is bundled with chef. While it doesn't  
> explode, it doesn't appear to do anything either:  
> [Thu, 21 Jul 2011 14:55:35 +0100] INFO: Run List expands to  
> [chef\_handler::json\_file]  
> [Thu, 21 Jul 2011 14:55:35 +0100] INFO: Starting Chef Run for kakistos.local  
> [Thu, 21 Jul 2011 14:55:37 +0100] INFO: Loading cookbooks [chef\_handler]  
> [Thu, 21 Jul 2011 14:55:37 +0100] INFO: Processing  
> chef\_handler[Chef::Handler::JsonFile] action enable  
> (chef\_handler::json\_file line 24)  
> [Thu, 21 Jul 2011 14:55:37 +0100] INFO: Processing  
> chef\_handler[Chef::Handler::JsonFile] action nothing  
> (chef\_handler::json\_file line 24)  
> [Thu, 21 Jul 2011 14:55:40 +0100] INFO: Chef Run complete in 4.402447 seconds  
> [Thu, 21 Jul 2011 14:55:40 +0100] INFO: Running report handlers  
> [Thu, 21 Jul 2011 14:55:40 +0100] INFO: Report handlers complete
> 
> The relevant chunk of the debug output:  
> [Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Loading cookbook  
> chef\_handler's providers from  
> /var/chef/cache/cookbooks/chef\_handler/providers/default.rb  
> [Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Loaded contents of  
> /var/chef/cache/cookbooks/chef\_handler/providers/default.rb into a  
> provider named chef\_handler defined in Chef::Provider::ChefHandler  
> [Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Loading cookbook  
> chef\_handler's resources from  
> /var/chef/cache/cookbooks/chef\_handler/resources/default.rb  
> [Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Loaded contents of  
> /var/chef/cache/cookbooks/chef\_handler/resources/default.rb into a  
> resource named chef\_handler defined in Chef::Resource::ChefHandler  
> [Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Node kakistos.local loading  
> cookbook chef\_handler's attribute file  
> /var/chef/cache/cookbooks/chef\_handler/attributes/default.rb  
> [Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Loading Recipe  
> chef\_handler::json\_file via include\_recipe  
> [Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Found recipe json\_file in  
> cookbook chef\_handler  
> [Thu, 21 Jul 2011 14:58:46 +0100] INFO: Processing  
> chef\_handler[Chef::Handler::JsonFile] action enable  
> (chef\_handler::json\_file line 24)  
> [Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Chef::Handler::JsonFile has  
> not been loaded  
> [Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Converging node kakistos.local  
> [Thu, 21 Jul 2011 14:58:46 +0100] INFO: Processing  
> chef\_handler[Chef::Handler::JsonFile] action nothing  
> (chef\_handler::json\_file line 24)  
> [Thu, 21 Jul 2011 14:58:46 +0100] DEBUG: Doing nothing for  
> chef\_handler[Chef::Handler::JsonFile]
> 
> Questions:
> 
> - Should this have done something?
> - How should I approach debugging this issue? (I'm really not sure  
> where to start)
> 
> All examples above are 0.10.2, on OS X, installed from gems. I've  
> also tried to get this working on an ubuntu VM, but met with exactly  
> the same results.
> 
> Thanks,
> 
> Zac

---

<div class="post-metadata">

**Author:** ![zts](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/zts/32/111_2.png) [@zts](https://discourse.chef.io/u/zts)\
**Post date:** [July 21, 2011, 4:14pm UTC](https://discourse.chef.io/t/installing-handlers-with-chef-handler/1936/3 "2011-07-21T16:14:41Z")

</div>

Hi Seth,

On Thu, Jul 21, 2011 at 5:01 PM, Seth Chisamore [schisamo@opscode.com](mailto:schisamo@opscode.com) wrote:

> You may have stumbled across a bug. I will try to recreate and open a COOK ticket if appropriate.

Thanks for the prompt response - it's appreciated.

> The JsonFile handler should drop a JSON file in '/var/chef/reports' when it fires.

Yeah, that's what I figured. Should it create the directory if it's  
not present?  
It didn't (assuming it fired), but creating the directory by hand  
didn't change anything.

> Also, we recommend you get cookbooks from the community site using 'knife cookbook site install' or 'knife cookbook site download'. The repository you forked, [Multiple vendor Chef cookbooks. · GitHub](http://github.com/cookbooks) is not an Opscode account, and we don't know what the state of the cookbooks in that repository might be. Opscode maintains the GitHub repository for development tracking, but not for released versions of cookbooks we can support. We push the released versions to [community.opscode.com](http://community.opscode.com). For more information see.

Duly noted - I did start off this exercise using the official cookbook  
(via "cookbook site install"), but cloning the unofficial repo seemed  
to make for a cleaner example. I should have noted this in my  
original post.

If the preference is to clone [GitHub - chef-boneyard/cookbooks: DEPRECATED: This repository has been split up into separate repositories by cookbook under the "opscode-cookbooks" organization.](http://github.com/opscode/cookbooks) as a whole,  
I'll stick with that in future to avoid confusion.

Cheers,

Zac

---

<div class="post-metadata">

**Author:** ![Seth\_Chisamore](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/seth_chisamore/32/488_2.png) [@Seth\_Chisamore](https://discourse.chef.io/u/Seth_Chisamore)\
**Post date:** [July 21, 2011, 4:26pm UTC](https://discourse.chef.io/t/installing-handlers-with-chef-handler/1936/4 "2011-07-21T16:26:39Z")

</div>

Zac,  
You could fork the repo, but the preferred way would be to just track the upstream cookbook in your local chef-repo using the 'vendor branch' pattern. An implementation of this pattern (that works with git) is built into 'knife cookbook site install'.

This command does the following:

- Download the cookbook tarball from [cookbooks.opscode.com](http://cookbooks.opscode.com).
- Ensure its on the git master branch (or specify with --branch option).
- Checks for an existing vendor branch, and creates if it doesn't.
- Checks out the vendor branch (chef-vendor-COOKBOOK).
- Removes the existing (old) version.
- Untars the cookbook tarball it downloaded in the first step.
- Adds the cookbook files to the git index and commits.
- Creates a tag for the version downloaded.
- Checks out the master (or desired) branch again.
- Merges the cookbook into master (or desired branch).

For more information on 'knife cookbook site install' and the vendor pattern check out the wiki page [0] on the topic.

Seth

--  
Opscode, Inc.  
Seth Chisamore, Senior Technical Evangelist  
IRC, Skype, Twitter, Github: schisamo

[0] [http://wiki.opscode.com/display/chef/Working+with+Git+and+Cookbooks](http://wiki.opscode.com/display/chef/Working+with+Git+and+Cookbooks)

On Thursday, July 21, 2011 at 12:14 PM, Zac Stevens wrote:

> Hi Seth,
> 
> On Thu, Jul 21, 2011 at 5:01 PM, Seth Chisamore \<[schisamo@opscode.com](mailto:schisamo@opscode.com) ([mailto:schisamo@opscode.com](mailto:schisamo@opscode.com))\> wrote:
> 
> > You may have stumbled across a bug. I will try to recreate and open a COOK ticket if appropriate.
> 
> Thanks for the prompt response - it's appreciated.
> 
> > The JsonFile handler should drop a JSON file in '/var/chef/reports' when it fires.
> 
> Yeah, that's what I figured. Should it create the directory if it's  
> not present?  
> It didn't (assuming it fired), but creating the directory by hand  
> didn't change anything.
> 
> > Also, we recommend you get cookbooks from the community site using 'knife cookbook site install' or 'knife cookbook site download'. The repository you forked, [Multiple vendor Chef cookbooks. · GitHub](http://github.com/cookbooks) ([Multiple vendor Chef cookbooks. · GitHub](http://github.com/cookbooks)) is not an Opscode account, and we don't know what the state of the cookbooks in that repository might be. Opscode maintains the GitHub repository for development tracking, but not for released versions of cookbooks we can support. We push the released versions to [community.opscode.com](http://community.opscode.com) ([http://community.opscode.com](http://community.opscode.com)). For more information see.
> 
> Duly noted - I did start off this exercise using the official cookbook  
> (via "cookbook site install"), but cloning the unofficial repo seemed  
> to make for a cleaner example. I should have noted this in my  
> original post.
> 
> If the preference is to clone [GitHub - chef-boneyard/cookbooks: DEPRECATED: This repository has been split up into separate repositories by cookbook under the "opscode-cookbooks" organization.](http://github.com/opscode/cookbooks) ([GitHub - chef-boneyard/cookbooks: DEPRECATED: This repository has been split up into separate repositories by cookbook under the "opscode-cookbooks" organization.](http://github.com/opscode/cookbooks)) as a whole,  
> I'll stick with that in future to avoid confusion.
> 
> Cheers,
> 
> Zac

---

<div class="post-metadata">

**Author:** ![zts](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/zts/32/111_2.png) [@zts](https://discourse.chef.io/u/zts)\
**Post date:** [July 21, 2011, 4:37pm UTC](https://discourse.chef.io/t/installing-handlers-with-chef-handler/1936/5 "2011-07-21T16:37:02Z")

</div>

Hi Seth,

On Thu, Jul 21, 2011 at 5:26 PM, Seth Chisamore [schisamo@opscode.com](mailto:schisamo@opscode.com) wrote:

> You could fork the repo, but the preferred way would be to just track the upstream cookbook in your local chef-repo using the 'vendor branch' pattern. An implementation of this pattern (that works with git) is built into 'knife cookbook site install'.
> 
> This command does the following:  
> \<--snip--\>

Yup, I know all that - but it's not much good for being able to show  
this list what I've done with the cookbook that I'm having trouble  
with 🙂

Other possible alternatives are pasting stuff into the message,  
attaching files, or dumping stuff into gists - but all of those feel a  
bit crufty.

In other words, there's a well-documented workflow for managing one's  
own repository, when everything's going well. However, that workflow  
doesn't seem well-suited either to soliciting help, or pushing  
fixes/improvements upstream. It's those angles I'm struggling with.

Cheers,

Zac

---

<div class="post-metadata">

**Author:** ![Seth\_Chisamore](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/seth_chisamore/32/488_2.png) [@Seth\_Chisamore](https://discourse.chef.io/u/Seth_Chisamore)\
**Post date:** [July 21, 2011, 5:30pm UTC](https://discourse.chef.io/t/installing-handlers-with-chef-handler/1936/6 "2011-07-21T17:30:34Z")

</div>

Zac,  
Totally understand.

So I was able to recreate the issue with your handler so I opened COOK-654 [0] and will try to get things fixed ASAP.

The JsonFile handler worked ok for me though. My file wrote out to:  
/var/chef/reports/chef-run-report-20110721165525.json

Seth

--  
Opscode, Inc.  
Seth Chisamore, Senior Technical Evangelist  
IRC, Skype, Twitter, Github: schisamo

[0] [http://tickets.opscode.com/browse/COOK-654](http://tickets.opscode.com/browse/COOK-654)

On Thursday, July 21, 2011 at 12:37 PM, Zac Stevens wrote:

> Hi Seth,
> 
> On Thu, Jul 21, 2011 at 5:26 PM, Seth Chisamore \<[schisamo@opscode.com](mailto:schisamo@opscode.com) ([mailto:schisamo@opscode.com](mailto:schisamo@opscode.com))\> wrote:
> 
> > You could fork the repo, but the preferred way would be to just track the upstream cookbook in your local chef-repo using the 'vendor branch' pattern. An implementation of this pattern (that works with git) is built into 'knife cookbook site install'.
> > 
> > This command does the following:  
> > \<--snip--\>
> 
> Yup, I know all that - but it's not much good for being able to show  
> this list what I've done with the cookbook that I'm having trouble  
> with 🙂
> 
> Other possible alternatives are pasting stuff into the message,  
> attaching files, or dumping stuff into gists - but all of those feel a  
> bit crufty.
> 
> In other words, there's a well-documented workflow for managing one's  
> own repository, when everything's going well. However, that workflow  
> doesn't seem well-suited either to soliciting help, or pushing  
> fixes/improvements upstream. It's those angles I'm struggling with.
> 
> Cheers,
> 
> Zac

---

<div class="post-metadata">

**Author:** ![Seth\_Chisamore](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/seth_chisamore/32/488_2.png) [@Seth\_Chisamore](https://discourse.chef.io/u/Seth_Chisamore)\
**Post date:** [July 21, 2011, 9:21pm UTC](https://discourse.chef.io/t/installing-handlers-with-chef-handler/1936/7 "2011-07-21T21:21:39Z")

</div>

Zac,  
The chef\_handler cookbook should be all fixed [0]. Please try version 1.0.4 which can be downloaded from the community site [1]:

knife cookbook site install chef\_handler

Hope that helps!

Seth

--  
Opscode, Inc.  
Seth Chisamore, Senior Technical Evangelist  
IRC, Skype, Twitter, Github: schisamo

[0] [http://tickets.opscode.com/browse/COOK-654](http://tickets.opscode.com/browse/COOK-654)  
[1] [http://community.opscode.com/cookbooks/chef\_handler](http://community.opscode.com/cookbooks/chef_handler)

On Thursday, July 21, 2011 at 12:37 PM, Zac Stevens wrote:

> Hi Seth,
> 
> On Thu, Jul 21, 2011 at 5:26 PM, Seth Chisamore \<[schisamo@opscode.com](mailto:schisamo@opscode.com) ([mailto:schisamo@opscode.com](mailto:schisamo@opscode.com))\> wrote:
> 
> > You could fork the repo, but the preferred way would be to just track the upstream cookbook in your local chef-repo using the 'vendor branch' pattern. An implementation of this pattern (that works with git) is built into 'knife cookbook site install'.
> > 
> > This command does the following:  
> > \<--snip--\>
> 
> Yup, I know all that - but it's not much good for being able to show  
> this list what I've done with the cookbook that I'm having trouble  
> with 🙂
> 
> Other possible alternatives are pasting stuff into the message,  
> attaching files, or dumping stuff into gists - but all of those feel a  
> bit crufty.
> 
> In other words, there's a well-documented workflow for managing one's  
> own repository, when everything's going well. However, that workflow  
> doesn't seem well-suited either to soliciting help, or pushing  
> fixes/improvements upstream. It's those angles I'm struggling with.
> 
> Cheers,
> 
> Zac

---

<div class="post-metadata">

**Author:** ![zts](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/zts/32/111_2.png) [@zts](https://discourse.chef.io/u/zts)\
**Post date:** [July 22, 2011, 12:09pm UTC](https://discourse.chef.io/t/installing-handlers-with-chef-handler/1936/8 "2011-07-22T12:09:00Z")

</div>

Hi Seth,

On Thu, Jul 21, 2011 at 10:21 PM, Seth Chisamore [schisamo@opscode.com](mailto:schisamo@opscode.com) wrote:

> The chef\_handler cookbook should be all fixed [0]. Please try version 1.0.4 which can be downloaded from the community site [1]:

Thanks again for fixing this so quickly!  
Tested as working, and now in use in my mcollective cookbook (also on  
the community site).

Cheers,

Zac
