Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

The chef_handler cookbook has been deprecated

Author provided reason for deprecation:

The chef_handler cookbook has been deprecated and is no longer being maintained by its authors. Use of the chef_handler cookbook is no longer recommended.


chef_handler (23) Versions 2.1.0

Distribute and enable Chef Exception and Report handlers

cookbook 'chef_handler', '= 2.1.0', :supermarket
cookbook 'chef_handler', '= 2.1.0'
knife supermarket install chef_handler
knife supermarket download chef_handler
Quality 86%

chef_handler Cookbook

Build Status Cookbook Version

Creates a configured handler path for distributing Chef report and exception handlers. Also exposes an LWRP for enabling Chef handlers from within recipe code (as opposed to hard coding in the client.rb file). This is useful for cookbook authors who may want to ship a product specific handler (see the cloudkick cookbook for an example) with their cookbook.



  • Debian/Ubuntu
  • RHEL/CentOS/Scientific/Amazon/Oracle
  • Windows


  • Chef 12.1+


  • none


node['chef_handler']['handler_path'] - location to drop off handlers directory, default is a folder named 'handlers' in Chef's file cache directory

Custom Resources


Requires, configures and enables handlers on the node for the current Chef run. Also has the ability to pass arguments to the handlers initializer. This allows initialization data to be pulled from a node's attribute data.

It is best to declare chef_handler resources early on in the compile phase so they are available to fire for any exceptions during the Chef run. If you have a base role you would want any recipes that register Chef handlers to come first in the run_list.


  • :enable: Enables the Chef handler for the current Chef run on the current node
  • :disable: Disables the Chef handler for the current Chef run on the current node

Attribute Parameters

  • class_name: name attribute. The name of the handler class (can be module name-spaced).
  • source: full path to the handler file. can also be a gem path if the handler ships as part of a Ruby gem. can also be nil, in which case the file must be loaded as a library.
  • arguments: an array of arguments to pass the handler's class initializer
  • supports: type of Chef Handler to register as, i.e. :report, :exception or both. default is :report => true, :exception => true


    # register the Chef::Handler::JsonFile handler
    # that ships with the Chef gem
    chef_handler "Chef::Handler::JsonFile" do
      source "chef/handler/json_file"
      arguments :path => '/var/chef/reports'
      action :enable

    # do the same but during the compile phase
    chef_handler "Chef::Handler::JsonFile" do
      source "chef/handler/json_file"
      arguments :path => '/var/chef/reports'
      action :nothing

    # handle exceptions only
    chef_handler "Chef::Handler::JsonFile" do
      source "chef/handler/json_file"
      arguments :path => '/var/chef/reports'
      supports :exception => true
      action :enable

    # enable the CloudkickHandler which was
    # dropped off in the default handler path.
    # passes the oauth key/secret to the handler's
    # intializer.
    chef_handler "CloudkickHandler" do
      source "#{node['chef_handler']['handler_path']}/cloudkick_handler.rb"
      arguments [node['cloudkick']['oauth_key'], node['cloudkick']['oauth_secret']]
      action :enable

    # enable the MyCorp::MyLibraryHandler handler which was dropped off in a
    # standard chef library file.
    chef_handler "MyCorp::MyLibraryHandler" do
      action :enable



Put the recipe chef_handler at the start of the node's run list to make sure that custom handlers are dropped off early on in the Chef run and available for later recipes.

For information on how to write report and exception handlers for Chef, please see the Chef wiki pages:


Leverages the chef_handler LWRP to automatically register the Chef::Handler::JsonFile handler that ships as part of Chef. This handler serializes the run status data to a JSON file located at /var/chef/reports.

Unit Testing

chef_handler provides built in chefspec matchers for assisting unit tests. These matchers will only be loaded if chefspec is already loaded. Following is an example of asserting against the jsonfile handler:

  expect(runner).to enable_chef_handler("Chef::Handler::JsonFile").with(
    source: "chef/handler/json_file",
    arguments: { :path => '/var/chef/reports'},
    supports: {:exception => true}

License & Authors

Author: Cookbook Engineering Team (

Copyright: 2011-2016, Chef Software, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

cassandra-dse Applicable Versions
chef-sentry-handler Applicable Versions
chef_cfn Applicable Versions
chef_changereport_handler Applicable Versions
chef_handler_sns Applicable Versions
chef_icinga2_handler Applicable Versions
cloudformation Applicable Versions
cloudinsight-agent Applicable Versions
configure_and_deploy_ssc Applicable Versions
cookbook_versions_handler Applicable Versions
copperegg Applicable Versions
datadog Applicable Versions
ddrelease Applicable Versions
diptables Applicable Versions
etckeeper Applicable Versions
eventlog Applicable Versions
gelf_handler Applicable Versions
graphite_handler Applicable Versions
graphite_reporting_handler Applicable Versions
hipchat Applicable Versions
hipchat_handler Applicable Versions
il-base Applicable Versions
influxdb Applicable Versions
lastrun_handler Applicable Versions
libsodium Applicable Versions
mcollective Applicable Versions
minitest Applicable Versions
minitest-handler Applicable Versions
motd Applicable Versions
oneapm-ci-agent Applicable Versions
openbazaar Applicable Versions
opentsdb_handler Applicable Versions
opsmatic Applicable Versions
powershell Applicable Versions
reboot Applicable Versions
reportchef Applicable Versions
run-notifier Applicable Versions
save_convergence_handler Applicable Versions
sentry-handler Applicable Versions
slack_handler Applicable Versions
splunk_handler Applicable Versions
summary_handlers Applicable Versions
syslog_handler Applicable Versions
teamforge-associations Applicable Versions
truesight-events Applicable Versions
windows Applicable Versions
zookeeper_bridge Applicable Versions

chef_handler cookbook CHANGELOG

This file is used to list changes made in each version of the chef_handler cookbook.

2.1.0 (2016-12-27)

  • Support Chefspec 4.1+ matchers only
  • Yank out converge_by to avoid bogus resource updates

2.0.0 (2016-09-16)

  • Testing updates
  • Require Chef 12.1

v1.4.0 (2016-05-13)

  • Allow defining handlers in a cookbook libraries and then enabling them with the chef_handler resource without actually providing a file as a source. This simplifies the delivery of the handler file itself. See the readme for an example.

v1.3.0 (2016-02-16)

  • Added state attributes to the custom resource
  • Added source_url and issues_url to metadata.rb
  • Replaced attributes for root user and group with the Ohai defined values to simplify the logic of the cookbook
  • Added lint, unit, and itegration testing in Travis CI
  • Added Test Kitchen testing of the recipes and the custom resource via a test cookbook
  • Added Berksfile
  • Added chefignore and .gitignore files
  • Added .rubocop.yml config and resolve multiple issues
  • Updated contributing and testing docs to the latest
  • Added all testing dependencies to the Gemfile
  • Added and maintainers.toml files
  • Expanded the Rakefile for simplified testing

v1.2.0 (2015-06-25)

  • Move to support Chef 12+ only. Removes old 'handler class reload' behavior - it isn't necessary because chef-client forks and doesn't share a process between runs.

v1.1.9 (2015-05-26)

  • Bugfixes from 1.1.8 - loading without source is not allowed again. Class unloading is performed more carefully. Tests for resource providers.

v1.1.8 (2015-05-14)

  • Updated Contribution and Readme docs
  • Fix ChefSpec matchers
  • Allow handler to load classes when no source is provided.

v1.1.6 (2014-04-09)

  • [COOK-4494] - Add ChefSpec matchers

v1.1.5 (2014-02-25)

  • [COOK-4117] - use the correct scope when searching the children class name


  • [COOK-2146] - style updates


  • [COOK-1989] - fix scope for handler local variable to the enable block


  • [COOK-1645] - properly delete old handlers
  • [COOK-1322] - support platforms that use 'wheel' as root group'


  • [COOK-1177] - doesn't work on windows due to use of unix specific attributes


  • [COOK-1069] - typo in chef_handler readme


  • [COOK-654] dont try and access a class before it has been loaded
  • fix bad boolean check (if vs unless)


  • [COOK-620] ensure handler code is reloaded during daemonized chef runs

Collaborator Number Metric

2.1.0 passed this metric

Contributing File Metric

2.1.0 passed this metric

Foodcritic Metric

2.1.0 passed this metric

License Metric

2.1.0 failed this metric

chef_handler does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, MIT, mit, GPL-2.0, gplv2, GPL-3.0, gplv3.

No Binaries Metric

2.1.0 passed this metric

Testing File Metric

2.1.0 passed this metric

Version Tag Metric

2.1.0 passed this metric