From 8b9cb4d92361f018c1f5041c77fe04b2a4a527f1 Mon Sep 17 00:00:00 2001 From: cruelsmith <92088441+cruelsmith@users.noreply.github.com> Date: Wed, 10 Aug 2022 12:41:46 +0200 Subject: [PATCH] Hotfix exec of wazuh-template.json Fix case where file does not exist so rm will not be called Fix sh incompatible process substitution <(...) can be used with bash but not with sh that exec uses. --- manifests/filebeat_oss.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/filebeat_oss.pp b/manifests/filebeat_oss.pp index c0682e0f..fe23c46c 100644 --- a/manifests/filebeat_oss.pp +++ b/manifests/filebeat_oss.pp @@ -47,7 +47,8 @@ # TODO: Include file into the wazuh/wazuh-puppet project or use file { checksum => '..' } for this instead of the exec construct. exec { 'cleanup /etc/filebeat/wazuh-template.json': command => '/bin/rm /etc/filebeat/wazuh-template.json', - unless => "/bin/cmp -s '/etc/filebeat/wazuh-template.json' <(curl -s https://raw.githubusercontent.com/wazuh/wazuh/${wazuh_extensions_version}/extensions/elasticsearch/7.x/wazuh-template.json)", + onlyif => '/bin/test -f /etc/filebeat/wazuh-template.json', + unless => "/bin/curl -s 'https://raw.githubusercontent.com/wazuh/wazuh/${wazuh_extensions_version}/extensions/elasticsearch/7.x/wazuh-template.json' | /bin/cmp -s '/etc/filebeat/wazuh-template.json'", } -> file { '/etc/filebeat/wazuh-template.json': owner => 'root',