Skip to content

Commit

Permalink
introduce chef_handler_enable to control the chef reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
jedi4ever committed Jan 30, 2014
1 parent f7974f0 commit cb60d13
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
# Chef handler version
default['datadog']['chef_handler_version'] = nil

# Enable the Chef handler to report to datadog
default['datadog']['chef_handler_enable'] = true

# Boolean to enable debug_mode, which outputs massive amounts of log messages
# to the /tmp/ directory.
default['datadog']['debug'] = false
Expand Down
22 changes: 12 additions & 10 deletions recipes/dd-handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@
require 'chef/handler/datadog'

# Create the handler to run at the end of the Chef execution
chef_handler "Chef::Handler::Datadog" do
source "chef/handler/datadog"
arguments [
:api_key => node['datadog']['api_key'],
:application_key => node['datadog']['application_key'],
:use_ec2_instance_id => node['datadog']['use_ec2_instance_id']
]
supports :report => true, :exception => true
action :nothing
end.run_action(:enable)
if node['datadog']['chef_handler_enable']
chef_handler "Chef::Handler::Datadog" do
source "chef/handler/datadog"
arguments [
:api_key => node['datadog']['api_key'],
:application_key => node['datadog']['application_key'],
:use_ec2_instance_id => node['datadog']['use_ec2_instance_id']
]
supports :report => true, :exception => true
action :nothing
end.run_action(:enable)
end

0 comments on commit cb60d13

Please sign in to comment.