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).
This commit is contained in:
Alex Vandiver 2024-03-29 20:48:07 +00:00 committed by Tim Abbott
parent 5bcb4e55d8
commit f9805c9e1f
1 changed files with 5 additions and 1 deletions

View File

@ -12,7 +12,11 @@ class kandra::prometheus::rabbitmq {
} }
exec { 'enable rabbitmq-prometheus-per-metric': exec { 'enable rabbitmq-prometheus-per-metric':
command => "rabbitmqctl eval 'application:set_env(rabbitmq_prometheus, return_per_object_metrics, true).'", 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'], require => Exec['enable rabbitmq-prometheus'],
} }
kandra::firewall_allow { 'rabbitmq': port => '15692' } kandra::firewall_allow { 'rabbitmq': port => '15692' }