Skip to content

Circular Dependency Error When referenced from another module #244

@jbcpollak

Description

@jbcpollak

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-feedbackFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions