Try to be rubocop compliant.
MODIFY
recipes/_agent6_config.rb
recipes/_agent6_config.rb
is_windows = node['platform_family'] == 'windows'
# use either the site option or the url one, the latter having priority.
-dd_url = 'https://app.datadoghq.com'
-if node['datadog']['site']
- dd_url = 'https://app.' + node['datadog']['site']
-end
-if node['datadog']['url']
- dd_url = node['datadog']['url']
-end
+node.run_state['dd_url'] = 'https://app.datadoghq.com'
+node.run_state['dd_url'] = 'https://app.' + node['datadog']['site'] unless node['datadog']['site'].nil?
+node.run_state['dd_url'] = node['datadog']['url'] unless node['datadog']['url'].nil?
agent6_config_file = ::File.join(node['datadog']['agent6_config_dir'], 'datadog.yaml')
template agent6_config_file do
@@ -37,7 +33,7 @@ template agent6_config_file do
url = if endpoint['url']
endpoint['url']
else
- dd_url
+ node.run_state['dd_url']
end
if additional_endpoints.key?(url)
additional_endpoints[url] << endpoint['api_key']

MODIFY
recipes/dd-agent.rb
recipes/dd-agent.rb
@@ -41,12 +41,8 @@ agent_start = node['datadog']['agent_start'] ? :start : :stop
# use either the site option or the url one, the latter having priority.
node.run_state['dd_url'] = 'https://app.datadoghq.com'
-if node['datadog']['site']
- node.run_state['dd_url'] = 'https://app.' + node['datadog']['site']
-end
-if node['datadog']['url']
- node.run_state['dd_url'] = node['datadog']['url']
-end
+node.run_state['dd_url'] = 'https://app.' + node['datadog']['site'] unless node['datadog']['site'].nil?
+node.run_state['dd_url'] = node['datadog']['url'] unless node['datadog']['url'].nil?
#
# Configures a basic agent

MODIFY
recipes/dd-handler.rb
recipes/dd-handler.rb
@@ -29,12 +29,8 @@ include_recipe 'chef_handler'
# use either the site option or the url one, the latter having priority.
node.run_state['dd_url'] = 'https://app.datadoghq.com'
-if node['datadog']['site']
- node.run_state['dd_url'] = 'https://app.' + node['datadog']['site']
-end
-if node['datadog']['url']
- node.run_state['dd_url'] = node['datadog']['url']
-end
+node.run_state['dd_url'] = 'https://app.' + node['datadog']['site'] unless node['datadog']['site'].nil?
+node.run_state['dd_url'] = node['datadog']['url'] unless node['datadog']['url'].nil?
ENV['DATADOG_HOST'] = node.run_state['dd_url']

Try to be rubocop compliant.