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

Circular Dependency Error When referenced from another module #244

Closed
jbcpollak opened this issue Jan 27, 2014 · 6 comments
Closed

Circular Dependency Error When referenced from another module #244

jbcpollak opened this issue Jan 27, 2014 · 6 comments
Labels
bug Something isn't working needs-feedback Further information is requested

Comments

@jbcpollak
Copy link

Hello,

I am using heira to manage my system configs, and have found multiple of my systems need a local nginx proxy, so I created a module with an init.pp that looks like this:

class localproxy (
  $exthostname,
  $cfg_append = {}
  )
{

  include ::nginx

  nginx::resource::upstream { 'local_app':
      ensure  => present,
      members => [
        'localhost:8080',
      ],
      require => [
        Class['::nginx'],
        Class['::nginx::package']
      ]
  }

  nginx::resource::vhost { "$exthostname" :
      ensure   => present,
      proxy    => 'http://local_app',
      location_cfg_append => $cfg_append,
  }
}

When I run puppet, I get this error:

Error: Could not apply complete catalog: Found 1 dependency cycle:
(Anchor[nginx::end] => Class[Nginx] => Nginx::Resource::Upstream[local_app] => File[/etc/nginx/conf.d/local_app-upstream.conf] => Class[Nginx::Service] => Service[nginx] => Class[Nginx::Service] => Anchor[nginx::end])
Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz

I have gone in circles (fitting I suppose), but am unable to figure out how to break this dependency cycle correctly.

@jbcpollak
Copy link
Author

If I remove this line:

include ::nginx

I get a seemingly never ending cycle of different errors, like this:

First run:

Error: Failed to apply catalog: Could not find dependent Class[Nginx::Service] for File[/etc/nginx/conf.d/local_app-upstream.conf] at /var/lib/puppetdata/staging/modules/nginx/manifests/resource/upstream.pp:57

Second run (no change):

Error: Failed to apply catalog: Could not find dependent Class[Nginx::Service] for File[/var/lib/puppet/concat/sites-available{hostname}.conf/fragments.concat.out] at /var/lib/puppetdata/staging/modules/concat/manifests/init.pp:218

Third run (no change):

Error: Failed to apply catalog: Could not find dependent Class[Nginx::Service] for File[/sites-available/{hostname}.conf] at /var/lib/puppetdata/staging/modules/concat/manifests/init.pp:228

Fourth Run (no change):

Error: Failed to apply catalog: Could not find dependency Class[Nginx] for Nginx::Resource::Upstream[local_app] at /var/lib/puppetdata/staging/modules/localproxy/manifests/init.pp:16

@jbcpollak
Copy link
Author

Hi, I believe I solved this problem by replacing this line:

include ::nginx

With these lines:

include ::nginx::config
include ::nginx::service
include ::nginx::package

I'm not sure if that is considered a bug or expected behavior, but it seems to work. I hope this note is useful for others too.

@bluecurio
Copy link

I am having the same problem (unrolled below for easier reading)...

err: Could not apply complete catalog: Found 1 dependency cycle:
( Anchor[nginx::end] 
  => Class[Nginx] 
  => Nginx::Resource::Vhost[vhost-searchhub] 
  => File[vhost-searchhub.conf symlink] 
  => Service[nginx]
  => Class[Nginx::Service] 
  => Anchor[nginx::end] )

Seems like nothing I do breaks this dependency cycle. Even unrolling the include nginx into it's constituent parts (as @jbcpollak above mentioned) will work. Not sure what to do here...

@shadone
Copy link

shadone commented Apr 14, 2015

I am hitting the same issue since recently, after experimenting a bit with different versions it seems 0.2.2 works fine for me but 0.2.3 triggers this.

@3flex 3flex added the bug Something isn't working label Apr 16, 2015
@3flex 3flex added bug Something isn't working and removed bug Something isn't working labels Apr 16, 2015
@3flex
Copy link
Contributor

3flex commented Apr 16, 2015

@shadone @bluecurio I've opened #609 to track your issue, which isn't the same as the one originally reported.

@jbcpollak are you still having problems here? I saw you have a workaround and the work to fix #609 is likely to improve the situation as well so if I don't hear back in a few days I'll close this.

@3flex 3flex added the needs-feedback Further information is requested label Apr 16, 2015
@3flex
Copy link
Contributor

3flex commented May 6, 2015

I'm closing this for now. @jbcpollak please comment if you have any information to add and I'll reopen. Thanks!

@3flex 3flex closed this as completed May 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-feedback Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants