Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Related: serverfault.com/questions/421023/… –  quanta Aug 31 '12 at 15:38

2 Answers 2

up vote 5 down vote accepted

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

Found this post after a while: http://www.mail-archive.com/puppet-users@googlegroups.com/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'],
  }
}
share|improve this answer

Include with prefix?

include main:nginx

share|improve this answer
    
Sorry: Could not find dependency Class[Main::Nginx] –  François Beausoleil Aug 31 '12 at 13:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.