Correctly write list of tags in Agent 5 configuration.
They were previously written as their string representation, meaning
an array containg "custom:tag1" and "custom:tag2" would have created the
tag `["custom:tag1"` and `"custom:tag2"]`. It was working correctly because
the Datadog servers were cleaning those extra chars.
MODIFY
templates/default/datadog.conf.erb
templates/default/datadog.conf.erb
@@ -20,7 +20,9 @@ developer_mode: <%= node['datadog']['developer_mode'] %>
<% if node['datadog']['tags'].respond_to?(:each_pair) -%>
tags: <%= node['datadog']['tags'].reject{ |_k,v| v.empty? }.map{ |k,v| "#{k}:#{v}" }.join(',') %>
-<% else -%>
+<% elsif node['datadog']['tags'].respond_to?(:join) %>
+tags: <%= node['datadog']['tags'].join(',') %>
+<% else %>
tags: <%= node['datadog']['tags'] %>
<% end -%>
<% if node['datadog']['create_dd_check_tags'] -%>

MODIFY
templates/default/datadog.yaml.erb
templates/default/datadog.yaml.erb
@@ -23,9 +23,9 @@ def string_list_to_array(string_list)
end
## Normalize complex config values for agent6 format ##
-if node['datadog']['tags'].is_a?(Hash)
+if node['datadog']['tags'].respond_to?(:each_pair)
tags = node['datadog']['tags'].reject{ |_k,v| v.empty? }.map{ |k,v| "#{k.strip}:#{v.strip}" }
-elsif node['datadog']['tags'].is_a?(Array)
+elsif node['datadog']['tags'].respond_to?(:each)
tags = node['datadog']['tags']
else
tags = string_list_to_array(node['datadog']['tags'])

Correctly write list of tags in Agent 5 configuration.

They were previously written as their string representation, meaning
an array containg "custom:tag1" and "custom:tag2" would have created the
tag `["custom:tag1"` and `"custom:tag2"]`. It was working correctly because
the Datadog servers were cleaning those extra chars.