puppet-prometheus
puppet-prometheus copied to clipboard
Systemd dependencies cycle with rabbitmq and rabbitmq-exporter
Hello, I am not sure if this is a puppet-prometheus or a puppet-rabbitmq issue but I am having a dependency cycle using them both: puppet-server: 2.8.1 puppet: 4.10.12 puppet-rabbitmq: 8.5.0 puppet-prometheus: 6.4.0 system: centos7
My manifest is has followed (The prometheus exporter should be added after Rabbitmq, that is why I have a require in the 'prometheus::rabbitmq_exporter' class)
node /^rabbitmq-node-.*.org$/ {
class { 'rabbitmq':
[some_config]
} ->
rabbitmq_vhost {
'some-vhost': [...];
} ->
rabbitmq_policy {
'some-policy': [...];
} ->
rabbitmq_user {
'some_user': [...];
} ->
rabbitmq_user_permissions {
'some_user_perms': [...];
}
rabbitmq_plugin {
some_plugin': [...];
}
class { 'prometheus::rabbitmq_exporter':
[some_config]
require => Class['rabbitmq']
}
}
The error that I have is:
Error: Failed to apply catalog: Found 1 dependency cycle:
(Exec[systemctl-daemon-reload] => Class[Systemd::Systemctl::Daemon_reload] => Service[rabbitmq-server] => Class[Rabbitmq::Service] => Class[Rabbitmq] => Class[Prometheus::Rabbitmq_exporter] => Prometheus::Daemon[rabbitmq_exporter] => Systemd::Unit_file[rabbitmq_exporter.service] => File[/etc/systemd/system/rabbitmq_exporter.service] => Class[Systemd::Systemctl::Daemon_reload] => Exec[systemctl-daemon-reload])
Any ideas ?
I've noticed the same error with other services that use the class Class[Systemd::Systemctl::Daemon_reload] so this is not limited to rabbitmq
I did a quick workaround in https://github.com/egnyte/puppet-prometheus/tree/v10.0.0_workaround_434 but I am not sure if it doesn't have side effects yet, so it's definitely not ready to create a PR.
You could be less strict with your relationships. You probably don't actually need every resource declared in the exporter (and specifically the unit_file) to come after every resource in rabbitmq.
Something like
class { 'prometheus::rabbitmq_exporter':
...
require => Class['rabbitmq::service'],
}
will probably break the dependency cycle.
I think that less ordering won't help, @alexjfisher .
Because in our code we do not have any ordering between the class that contains prometheus::rabbitmq_exporter and the rabbitmq resources and we still had this dependency cycle.
I think this is obsolete and only affects outdated puppet versions. Pleas re-open the issue if I am wrong.