Skip to content

Commit

Permalink
Don't log the agent configuration changes (#274)
Browse files Browse the repository at this point in the history
* Don't log the agent configuration changes

This will work on any Chef Client 11.14+ by suppressing the diff output in the logs to prevent API credentials from leaking into logs

* Use better feature detection

This feature was introduced with Chef 11.14 so we're checking the resource instance methods since it was added to the File, Template, and Execute resources.

* Apply sensitive to the datadog_monitor resource
  • Loading branch information
martinisoft authored and miketheman committed Apr 16, 2016
1 parent 689d3d4 commit f6010ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions providers/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def whyrun_supported?
:instances => new_resource.instances
)
cookbook new_resource.cookbook
sensitive true if Chef::Resource.instance_methods(false).include?(:sensitive)
notifies :restart, 'service[datadog-agent]', :delayed if node['datadog']['agent_start']
end

Expand All @@ -36,6 +37,7 @@ def whyrun_supported?
Chef::Log.debug "Removing #{new_resource.name} from #{confd_dir}"
file ::File.join(confd_dir, "#{new_resource.name}.yaml") do
action :delete
sensitive true if Chef::Resource.instance_methods(false).include?(:sensitive)
notifies :restart, 'service[datadog-agent]', :delayed if node['datadog']['agent_start']
end

Expand Down
1 change: 1 addition & 0 deletions recipes/dd-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
:api_key => node['datadog']['api_key'],
:dd_url => node['datadog']['url']
)
sensitive true if Chef::Resource.instance_methods(false).include?(:sensitive)
end

# Common configuration
Expand Down

0 comments on commit f6010ca

Please sign in to comment.