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 #894

Open
BarnumD opened this issue Feb 7, 2023 · 3 comments
Open

Dependency cycle #894

BarnumD opened this issue Feb 7, 2023 · 3 comments

Comments

@BarnumD
Copy link

BarnumD commented Feb 7, 2023

Describe the Bug

I've recently upgraded from v4.1.2 to v6.0.2 and ever since my server has been failing to run puppet.

A clear and concise description of what the bug is.
There are two or more profiles being applied to the host. Each of the two include a docker_compose and docker::image, but the two are unique. This configuration was working in version 4.1.2.

We are now getting the following error:
Error: Found 1 dependency cycle:
(Docker_compose[elasticsearch] => Class[Profiles::elasticsearch] => Class[Profiles::traefik] => Docker::Image[traefik] => Exec[/usr/local/bin/update_docker_image.sh traefik:latest] => Docker::Image[traefik] => Docker_compose[elasticsearch])\nCycle graph written to /opt/puppetlabs/puppet/cache/state/graphs/cycles.dot.
Error: Failed to apply catalog: One or more resource dependency cycles detected in graph

Expected Behavior

Puppet should check the image and compose and proceed with changes, but probably not do anything since no changes are required.

Steps to Reproduce

#Traefik profile
class profiles::traefik (
  $traefik_image_tag = 'latest'
){
  docker::image { 'traefik':
    image_tag => $traefik_image_tag,
  }

  docker_compose { 'traefik':
    ensure        => present,
    compose_files => ['/docker/traefik/docker-compose.yml'],
    subscribe     => File['/docker/traefik/docker-compose.yml'],
    require       => [File['/docker/traefik/docker-compose.yml'],File['/docker/traefik/traefik.yml'],File['/docker/traefik/traefik-dynamic.yml']],
  }
}

#ElasticSearch Profile
class profiles::elasticsearch (
  $elasticsearch_image_tag                  = '8.6.1',
){

  docker::image { 'elasticsearch':
    image_tag => $elasticsearch_image_tag,
  }

  docker_compose { 'elasticsearch':
    ensure        => present,
    compose_files => ['/docker/elasticsearch/docker-compose.yml'],
    subscribe     => File['/docker/elasticsearch/docker-compose.yml'],
  }
}

Environment

  • Module Version: 6.0.2
  • Puppet agent: 7.21.0
  • Platform: Ubuntu 22.04.
@kenyon
Copy link
Contributor

kenyon commented Feb 7, 2023

I'd guess that the problem is that you have both require and subscribe to the compose files in the docker_compose resource. You only need subscribe, that already implies that the compose files are applied before the docker_compose.

@BarnumD
Copy link
Author

BarnumD commented Feb 8, 2023

I removed require entirely, but got basically the same error. I subsequently removed subscribe but got the same.

(Docker_compose[elasticsearch] => Class[Profiles::elasticsearch] => Class[Profiles::traefik] => Docker::Image[traefik] => Exec[/usr/local/bin/update_docker_image.sh traefik:latest] => Docker::Image[traefik] => Docker_compose[elasticsearch])\nTry the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz

@BarnumD
Copy link
Author

BarnumD commented Feb 8, 2023

I did some more testing and this problem exists in 4.2.0 and above, but not in 4.1.2.

If I remove the following it works, but not the other way around (if I remove docker::image { 'elasticsearch'

docker::image { 'traefik':
  image_tag => $traefik_image_tag,
}

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

No branches or pull requests

3 participants