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

File['collectd.d'] -> Concat <| tag == 'collectd' |> is too greedy #1000

Closed
traylenator opened this issue Aug 11, 2022 · 2 comments · Fixed by #1003
Closed

File['collectd.d'] -> Concat <| tag == 'collectd' |> is too greedy #1000

traylenator opened this issue Aug 11, 2022 · 2 comments · Fixed by #1003

Comments

@traylenator
Copy link
Contributor

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7
  • puppet-collectd v13.0.0

How to reproduce (e.g Puppet code you use)

yum::versionlock{'collectd':
  ensure  => present,
  version => '5',
  before  => Class['collectd']
}                                  

contain collectd

What are you seeing

Circular dependency

$  sudo puppet apply --noop test.pp 
Error: Found 1 dependency cycle:
(Concat_file[/etc/dnf/plugins/versionlock.list] => Concat[/etc/dnf/plugins/versionlock.list] => Class[Yum::Plugin::Versionlock] => Yum::Versionlock[collectd] => Concat::Fragment[yum-versionlock-collectd] => Concat_fragment[yum-versionlock-collectd] => Concat::Fragment[yum-versionlock-collectd] => Yum::Versionlock[collectd] => Class[Collectd] => Class[Collectd::Config] => File[collectd.d] => Concat[/etc/dnf/plugins/versionlock.list] => Concat_file[/etc/dnf/plugins/versionlock.list])\nTry the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz
Error: Failed to apply catalog: One or more resource dependency cycles detected in graph

The yum::versionlock is incorrectl matched by the File['collectd.d'] -> Concat <| tag == 'collectd' |>

What behaviour did you expect instead

Not a circular dependency

@traylenator
Copy link
Contributor Author

traylenator commented Aug 11, 2022

Infuriatingly

File['collectd.d'] -> Concat <| tag == 'collectd' and path > '/etc/collectd.d/' |>

does not work , only == and != work there.

@ekohl
Copy link
Member

ekohl commented Aug 31, 2022

I wonder if using the collectd::plugin tag would work. Then you still need to take care of collectd::typesdb, collectd::config and collectd::type, but that is more manageable.

traylenator added a commit to traylenator/puppet-collectd that referenced this issue Sep 1, 2022
Previously all the concat's created typically in
`/etc/collect.d` were subject to

```
File['collectd.d'] -> Concat <| tag == 'collectd' |>
```
to ensure the directory was in place first.

This turns out to be too greedy and can cause problems
as per voxpupuli#1000.

Instead be explicit about requiring the directory on
the concat files that are bing created.

Consequence of this if concat files are being created
in `/etc/collect.d` outside this module they will now
have to require this directory. At worst such configuration
would require a second puppet run.
traylenator added a commit to traylenator/puppet-collectd that referenced this issue Sep 2, 2022
Previously all the concat's created typically in /etc/collect.d were subject to

File['collectd.d'] -> Concat <| tag == 'collectd' |>
to ensure the directory was in place first.

This turns out to be too greedy and can cause problems as per voxpupuli#1000.

This declaration is unnecessary as concat creates a file type
and this auto-requires the directory one level above.
traylenator added a commit to traylenator/puppet-collectd that referenced this issue Sep 2, 2022
Previously all the concat's created typically in /etc/collect.d were subject to

File['collectd.d'] -> Concat <| tag == 'collectd' |>
to ensure the directory was in place first.

This turns out to be too greedy and can cause problems as per voxpupuli#1000.

This declaration is unnecessary as concat creates a file type
and this auto-requires the directory one level above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants