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

Package[openldap] is already declared at #288

Open
stormbard opened this issue Apr 23, 2021 · 2 comments
Open

Package[openldap] is already declared at #288

stormbard opened this issue Apr 23, 2021 · 2 comments

Comments

@stormbard
Copy link

If you already have the package openldap already defined else where with ensure_packages(['openldap-devel', 'openldap', 'openssl'], {'ensure' => 'present'}) you get an error.

Failed on TARGET:
  Apply failed to compile for TARGET: Duplicate declaration: Package[openldap] is already declared at (file: /PATH/modules/profile/manifests/ad.pp, line: 3); cannot redeclare (file: /PATH/.modules/openldap/manifests/client/install.pp, line: 8) (file: /PATH/.modules/openldap/manifests/client/install.pp, line: 8, column: 3)
Failed on 1 target: TARGET

We like to define the installed packages explicitly so this is causing us a few issues. Is it possible to make the module do a check to see if this dependency is already defined before adding it again?

@smortex
Copy link
Member

smortex commented Sep 27, 2021

Is it possible to make the module do a check to see if this dependency is already defined before adding it again?

I would consider this an anti-pattern: I would expect the module to manage the package, and if the package is managed outside of the module, raise an error like it currently does.

If you have a use case for which managing the package in the module is not great, I would rather suggest adding a parameter manage_package that defaults to true and when set to false skip completely package management, like it is done in various modules.

@stormbard
Copy link
Author

The use case is that we have explicit package management defined elsewhere. One source of truth for what packages get installed via puppet rather than asking which module installed that or digging through multiple files. It feels weird that I'm getting punished for being detailed and explicit rather than expecting and hoping a module would do it for me.

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

No branches or pull requests

2 participants