Remove equality conditions with booleans
MODIFY
recipes/_agent6_config.rb
recipes/_agent6_config.rb
@@ -64,5 +64,5 @@ template agent_config_file do
end
)
sensitive true if Chef::Resource.instance_methods(false).include?(:sensitive)
- notifies :restart, 'service[datadog-agent]', :delayed unless node['datadog']['agent_start'] == false
+ notifies :restart, 'service[datadog-agent]', :delayed if node['datadog']['agent_start']
end

MODIFY
recipes/dd-agent.rb
recipes/dd-agent.rb
@@ -152,7 +152,7 @@ service 'datadog-agent' do
else
supports :restart => true, :status => true, :start => true, :stop => true
end
- subscribes :restart, "template[#{agent_config_file}]", :delayed unless node['datadog']['agent_start'] == false
+ subscribes :restart, "template[#{agent_config_file}]", :delayed if node['datadog']['agent_start']
# HACK: the restart can fail when we hit systemd's restart limits (by default, 5 starts every 10 seconds)
# To workaround this, retry once after 5 seconds, and a second time after 10 seconds
retries 2

MODIFY
recipes/system-probe.rb
recipes/system-probe.rb
@@ -44,9 +44,9 @@ template system_probe_config_file do
owner 'root'
group 'dd-agent'
mode '640'
- notifies :restart, 'service[datadog-agent-sysprobe]', :delayed unless node['datadog']['system_probe']['enabled'] == false
+ notifies :restart, 'service[datadog-agent-sysprobe]', :delayed if node['datadog']['system_probe']['enabled']
# since process-agent collects network info through system-probe, enabling system-probe should also restart process-agent
- notifies :restart, 'service[datadog-agent]', :delayed unless node['datadog']['system_probe']['enabled'] == false
+ notifies :restart, 'service[datadog-agent]', :delayed if node['datadog']['system_probe']['enabled']
end
# Common configuration
@@ -63,5 +63,5 @@ service 'datadog-agent-sysprobe' do
action [sysprobe_agent_start]
provider service_provider unless service_provider.nil?
supports :restart => true, :status => true, :start => true, :stop => true
- subscribes :restart, "template[#{system_probe_config_file}]", :delayed unless node['datadog']['system_probe']['enabled'] == false
+ subscribes :restart, "template[#{system_probe_config_file}]", :delayed if node['datadog']['system_probe']['enabled']
end

MODIFY
templates/default/datadog.conf.erb
templates/default/datadog.conf.erb
@@ -39,7 +39,7 @@ proxy_user: <%= node['datadog']['web_proxy']['user'] %>
proxy_password: <%= node['datadog']['web_proxy']['password'] %>
<% end -%>
-<% if node['datadog']['non_local_traffic'] == true %>
+<% if node['datadog']['non_local_traffic'] %>
non_local_traffic: true
<% end -%>

Remove equality conditions with booleans (#733)