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.

RSS

chef_handler (23) Versions 3.0.3

Distribute and enable Chef Exception and Report handlers

Policyfile
Berkshelf
Knife
cookbook 'chef_handler', '~> 3.0.3', :supermarket
cookbook 'chef_handler', '~> 3.0.3'
knife supermarket install chef_handler
knife supermarket download chef_handler
README
Dependencies
Changelog
Quality 17%

chef_handler Cookbook

Build Status Cookbook Version

Provides a resource for installing and automatically loading Chef report and exception handlers.

Deprecation

The chef_handler resource from this cookbook is now shipping as part of Chef 14. With the inclusion of this resource into Chef itself we are now deprecating this cookbook. It will continue to function for Chef 13 users, but will not be updated.

Requirements

Platforms

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

Chef

  • Chef 12.7+

Cookbooks

  • none

Attributes

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

Resources

chef_handler

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.

Actions

  • :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 property. 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
  • type: type of Chef Handler to register as, i.e. :report, :exception or both. default is :report => true, :exception => true

Example

  # 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
  end

  # 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
  end.run_action(:enable)

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

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

Usage

default

This cookbook's default recipe has been deprecated. To setup your own handlers you should instead use the chef_handler resource documented above within your own cookbook to define handlers.

json_file

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' },
    type: { exception: true }
  )

License & Authors

Author: Cookbook Engineering Team (cookbooks@chef.io)

Copyright: 2011-2017, 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

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.

3.0.3 (2018-04-04)

  • Add deprecation notice. The chef_handler resource is now included in Chef 14. This cookbook has been deprecated, but will continue to function for Chef 13 users.

3.0.2 (2017-07-04)

  • Fix namespace collision with helper module

3.0.1 (2017-06-23)

  • Make sure arguments can be a hash not just an array

3.0.0 (2017-06-20)

  • Remove the ability to install handlers via the files directory in this cookbook. This is a very old pattern that Chef (Opscode) pushed in ~2009/~2010 which required you to fork the cookbook so you could add your own files locally. There's a resource now and handlers should be installed using that resource.
  • Converted the handler LWRP to a custom resource, which makes Chef 12.7 the minimum version of chef-client supported
  • Converted the 'supports' property to a new property called 'type', which prevents deprecation warnings for Chef 12 users. Calls to the existing property will continue to work, but documentation now points to the new property.

2.1.2 (2017-06-19)

  • Use a SPDX standard license string
  • Remove CloudkickHandler references from the readme
  • Use default_action in the resource to resolve FC074
  • Reduce handler location log level to debug

2.1.1 (2017-04-11)

  • Fixed Chef 13 compatibility
  • Add supported OS list to metadata

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 maintainers.md 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

v1.1.4

  • [COOK-2146] - style updates

v1.1.2

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

v1.1.0

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

v1.0.8

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

v1.0.6

  • [COOK-1069] - typo in chef_handler readme

v1.0.4

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

v1.0.2

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

Collaborator Number Metric
            

3.0.3 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

3.0.3 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Cookstyle Metric
            

3.0.3 failed this metric

Chef/Deprecations/ResourceWithoutUnifiedTrue: Set `unified_mode true` in Chef Infra Client 15.3+ custom resources to ensure they work correctly in Chef Infra Client 18 (April 2022) when Unified Mode becomes the default. (https://docs.chef.io/workstation/cookstyle/chef_deprecations_resourcewithoutunifiedtrue): chef_handler/resources/default.rb: 1
Chef/Modernize/DefinesChefSpecMatchers: ChefSpec matchers are now auto generated by ChefSpec 7.1+ and do not need to be defined in a cookbook (https://docs.chef.io/workstation/cookstyle/chef_modernize_defineschefspecmatchers): chef_handler/libraries/matchers.rb: 21

Run with Cookstyle Version 7.32.1 with cops Chef/Deprecations,Chef/Correctness,Chef/Sharing,Chef/RedundantCode,Chef/Modernize,Chef/Security,InSpec/Deprecations

No Binaries Metric
            

3.0.3 passed this metric

Testing File Metric
            

3.0.3 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

3.0.3 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number