From de1dbcbfba6b8d5936e3a5f9b31d79983c4db8ff Mon Sep 17 00:00:00 2001 From: Aaron Kalin Date: Tue, 9 Feb 2016 20:50:26 -0600 Subject: [PATCH 1/3] 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 --- recipes/dd-agent.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/dd-agent.rb b/recipes/dd-agent.rb index f8fcbfc4..8b264dcf 100644 --- a/recipes/dd-agent.rb +++ b/recipes/dd-agent.rb @@ -63,6 +63,7 @@ :api_key => node['datadog']['api_key'], :dd_url => node['datadog']['url'] ) + sensitive true if Chef::Resource::ChefGem.instance_methods(false).include?(:sensitive) end # Common configuration From 48f70e9a5feeaf18bdeea95df6c41288e95dfe9a Mon Sep 17 00:00:00 2001 From: Aaron Kalin Date: Sat, 12 Mar 2016 13:00:45 -0600 Subject: [PATCH 2/3] 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. --- recipes/dd-agent.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/dd-agent.rb b/recipes/dd-agent.rb index 8b264dcf..970bb4c8 100644 --- a/recipes/dd-agent.rb +++ b/recipes/dd-agent.rb @@ -63,7 +63,7 @@ :api_key => node['datadog']['api_key'], :dd_url => node['datadog']['url'] ) - sensitive true if Chef::Resource::ChefGem.instance_methods(false).include?(:sensitive) + sensitive true if Chef::Resource.instance_methods(false).include?(:sensitive) end # Common configuration From 48c07d3f80cfb78b76ec0a7434db01ec02a52d3f Mon Sep 17 00:00:00 2001 From: Aaron Kalin Date: Wed, 16 Mar 2016 17:42:40 -0400 Subject: [PATCH 3/3] Apply sensitive to the datadog_monitor resource --- providers/monitor.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/providers/monitor.rb b/providers/monitor.rb index f438e226..493a562d 100644 --- a/providers/monitor.rb +++ b/providers/monitor.rb @@ -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 @@ -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