From f9805c9e1fdd873bf56fabd81ac20aaa65578530 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Fri, 29 Mar 2024 20:48:07 +0000 Subject: [PATCH] kandra: rabbitmqctl may not exist when applying the initial catalog. puppet hard-fails if it can't find the binary to run in `$PATH`, so we need to make the `unless` short-circuit to false if puppet itself is not installed yet (as during initial installation). --- puppet/kandra/manifests/prometheus/rabbitmq.pp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/puppet/kandra/manifests/prometheus/rabbitmq.pp b/puppet/kandra/manifests/prometheus/rabbitmq.pp index e2819ee224..64f99df75b 100644 --- a/puppet/kandra/manifests/prometheus/rabbitmq.pp +++ b/puppet/kandra/manifests/prometheus/rabbitmq.pp @@ -12,7 +12,11 @@ class kandra::prometheus::rabbitmq { } exec { 'enable rabbitmq-prometheus-per-metric': command => "rabbitmqctl eval 'application:set_env(rabbitmq_prometheus, return_per_object_metrics, true).'", - unless => "rabbitmqctl eval 'application:get_env(rabbitmq_prometheus, return_per_object_metrics).' | grep -q true", + unless => @("EOT"), + [ -f /usr/sbin/rabbitmqctl ] && + /usr/sbin/rabbitmqctl eval 'application:get_env(rabbitmq_prometheus, return_per_object_metrics).' \ + | grep -q true + | EOT require => Exec['enable rabbitmq-prometheus'], } kandra::firewall_allow { 'rabbitmq': port => '15692' }