edestecd / puppet-mariadb

Puppet Module for managing MariaDB
GNU General Public License v3.0
3 stars 21 forks source link

Package Dependency Chain without tags breaks module for multistage environments #50

Open oniGino opened 3 years ago

oniGino commented 3 years ago

In https://github.com/edestecd/puppet-mariadb/blob/master/manifests/repo/yum.pp line 18

Yumrepo['mariadb'] -> Package<| |> should read something like Yumrepo['mariadb'] -> Package<| tag == 'mariadb'|>

Or else you have now required yumrepo to run prior to ALL packages in the entire repo, this includes packages not in the same stage as the class calls to this module. Thus creating dependency cycles

tag your package calls appropriately then add a tag to this dependency to fix

here is an example of the cycle from my codebase

(Anchor[::dnsmasq::end] => Class[Dnsmasq] => Stage[pre] => Stage[main] => Class[Mariadb::Repo::Yum] => Yumrepo[mariadb] => Package[puppet-agent] => Class[Puppet_agent::Install] => Stage[pre])\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

The package that is now required for YumRepo[mariadb] has no association what so ever with this module

edestecd commented 3 years ago

Are these packages tagged in the puppetlabs/mysql module like this? We rely in that module to actually install the packages

edestecd commented 3 years ago

It looks like no: https://github.com/puppetlabs/puppetlabs-mysql/blob/main/manifests/server/install.pp#L8

edestecd commented 3 years ago

If you wanted to make a PR against puppetlabs/mysql to add tags to the package resources first then this seems like a good solution

oniGino commented 3 years ago

Ok so why not just do

Yumrepo['mariadb'] -> Package<| name == 'mysql-server'|>

its faster than me filing multiple PR's and waiting forever for a version bump