7

I have the following definitions:

class nginx::install{
  ...
}

class nginx::service{
  ...
}

class nginx::config{
  ...
}

class nginx{
  include nginx::install, nginx::service, nginx::config
}

class jenkins::nginx{
  include nginx

  file{'/etc/nginx/sites-enabled/jenkins':
    source => ...,
    require => Class['nginx'],
  }
}

But when I run this, Puppet tells me that I have a cycle:

err: Could not apply complete catalog: Found 1 dependency cycle:
(Class[Jenkins::Nginx] => File[/etc/nginx/sites-available/jenkins] => Class[Jenkins::Nginx])
Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz

The plain reference to nginx in jenkins::nginx references itself. How do I tell Puppet that I depend on the top-level nginx class instead?

I tried to change my dependency to Class['::nginx'] (as if I was in Ruby), and Puppet now tells me it can't find the dependency.

1

2 Answers 2

7

Did a ton of testing as your question was interesting...

Found this post after a while: http://www.mail-archive.com/[email protected]/msg08224.html

I agree with the poster that this is a bug, or at least not well designed, but if you include the class with absolute scope (::nginx), you can then set a require to it, like so:

class jenkins::nginx{
  include ::nginx

  file{'/etc/nginx/sites-enabled/jenkins':
    source => ...,
    require => Class['::nginx'],
  }
}
0

Include with prefix?

include main:nginx

1
  • Sorry: Could not find dependency Class[Main::Nginx] Aug 31, 2012 at 13:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .