Closed suchAdemon closed 1 year ago
Hello! 👋
This issue has been open for a while and has had no recent activity. We've labelled it with attention-needed
so that we can get a clear view of which issues need our attention.
If you are waiting on a response from us we will try and address your comments on a future Community Day.
Alternatively, if it is no longer relevant to you please close the issue with a comment.
i dont think this is something that would happen as it would be a massive change to the current functionality and affect way to many things. I think that the best way to do resolve this is for you to also use ensure_packages in your own code.
to maintain the dependency you can use chaining e.g.
ensure_packages(['gnupg'])
Exec['apt_update'] -> Package['gnupg']
# or perhaps for all packages
Exec['apt_update'] -> Package<| |>
Part of your issue is probably this (IMO) completely unnecessary breaking change that was introduced in 8.0.0. https://github.com/puppetlabs/puppetlabs-stdlib/pull/1196
'fixing' that is still somewhere on my todo list.
Use Case
supported puppet modules use sometimes the ensure_package function, which leads to a duplicate declaration error if you have it already defined in another manifest which gets included during the catalog build.
Describe the Solution You Would Like
the function ensure_package could check, as it does already for the packages puppet and facter, if it is somewhere defined in the current build catalog, to allow the defined resources from the manifest to be used instead of the ensure_package function.
Describe Alternatives You've Considered
I have thought about patching the upstream puppetlabs-apt module by adding a if condition with something like
if ! (defined(Package['<packagename>']) {
but that would mean on each update of the modules I would need to take care of getting back my change. Another solution could be, that I place an if condition in front of theinclude
command based on the puppet role which is used. Both are not a really nice to have, but would work.Additional Context
Found it while using the puppetlabs-apt module which uses ensure_package(['gnupg']), also I have a package resource which is already defined in an existing manifest. As soon both are used for the same catalog build, it runs into a duplicate declaration error.
puppetlabs-apt: v8.4.1 puppetlabs-stdlib: v8.2.0
Error:
With this extension of ensure_package, puppet would make sure that the defined attributes on the package resource are getting used instead of "just" an
ensure => present/installed
as things like that are sometimes required.