From e5946b607c18f4e74233cf1a3cf9c2e38d5527ec Mon Sep 17 00:00:00 2001 From: Jaime Fullaondo Date: Tue, 31 Dec 2019 11:57:19 +0100 Subject: [PATCH] [monitor] Fix issues with directory creation on windows (#678) * Fix process directory permisions on windows * Remove unreachable else statement Co-authored-by: Kylian Serrania --- resources/monitor.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/monitor.rb b/resources/monitor.rb index 5770e36a93f96..64d47a2547af8 100644 --- a/resources/monitor.rb +++ b/resources/monitor.rb @@ -18,9 +18,13 @@ if Chef::Datadog.agent_major_version(node) != 5 directory ::File.join(yaml_dir, "#{new_resource.name}.d") do - owner 'dd-agent' - group 'dd-agent' - mode '755' + if node['platform_family'] == 'windows' + inherits true # Agent 6/7 rely on inheritance being enabled. Reset it in case it was disabled when installing Agent 5. + else + owner 'dd-agent' + group 'dd-agent' + mode '755' + end end yaml_file = ::File.join(yaml_dir, "#{new_resource.name}.d", 'conf.yaml') else