Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency cycle when using sensu::handler in the same catalogue as sensu server #186

Closed
anthcourtney opened this issue May 24, 2014 · 4 comments

Comments

@anthcourtney
Copy link

I am getting the following error from the puppet agent run on the host which is my sensu server.

        Could not apply complete catalog: Found 1 dependency cycle:
        (Anchor[sensu::end] => Class[Sensu] => Class[Sensu_config::Handler::Pagerduty] => Sensu::Handler[pagerduty] => Sensu_handler[pagerduty] => Service[sensu-server] => Class[Sensu::Server::Service] => Class[Sensu::Dashboard::Service] => Service[sensu-dashboard] => Class[Sensu::Dashboard::Service] => Anchor[sensu::end])

The following is the relevant configuration on this host:

class sensu_config::server {
...
  class { 'sensu':
    rabbitmq_user      => $rabbitmq_user,
    rabbitmq_password  => $rabbitmq_password,
    rabbitmq_vhost     => $rabbitmq_vhost,
    rabbitmq_host      => $rabbitmq_host,
    rabbitmq_port      => $rabbitmq_port,
    subscriptions      => ["${environment}","${role}"],
    server            => true,
    client            => false,
    dashboard         => true,
    api               => true,
    use_embedded_ruby => true,
    manage_services   => true,
    require => [ Class['sensu_config::server::redis'],
                 Class['sensu_config::server::rabbitmq']]
  }
class sensu_config::handler::pagerduty {
...
  sensu::handler { 'pagerduty':
    command => "${::sensu_config::handlers_path}/pagerduty.rb",
    config => {
      'api_key' => hiera('pagerduty::api_key', '12345'),
    },
    require => File["${::sensu_config::handlers_path}/pagerduty.rb"]
  }

This happens for any handler that I specify. Not specifying any handlers results in no errors.

@jlambert121
Copy link
Contributor

Why are you adding the require on your class { 'sensu': } definition? The module should take care of that itself. If it isn't we have an issue there that needs to be resolved.

If you remove those do you still have the problem?

@anthcourtney
Copy link
Author

That works but I am not sure why, as the require is for two custom internal classes which ensure redis/rabbitmq are installed/configured appropriately, and do not configure sensu at all.

@jlambert121
Copy link
Contributor

I just realized the requires are sensu_config not sensu, but that fixing does sound like we're heading down the right path.

Looking at your dependency loop at the top, it looks like one of your sensu_config classes is setting up sensu::handler{'pagerduty'}. The handler requires the rest of the sensu class to complete before it can be installed, but the sensu class is requiring your config to complete before it can be installed.

The Sensu module itself will take care of restarts as its config changes so you shouldn't need to require anything for the sensu class except the actual redis and rabbitmq setup and config, all other things that are sensu defines (sensu::check, sensu::handler....) should not be in the require chain.

Does that make sense?

@jlambert121
Copy link
Contributor

I'm going to go ahead and close this one, I believe it is an issue between the interaction of your sensu_config class and the sensu class and a circular require dependency between them rather than an issue with the sensu module. If this isn't correct, please reopen this and provide a copy of your sensu_config module (with sensitive things redacted).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants