Avoid conflicts with an already declared curl package#617
Avoid conflicts with an already declared curl package#617adepretis wants to merge 1 commit intogarethr:masterfrom 25th-floor:PR/conflicting_curl_package
Conversation
|
isn't this what ensure_packages() packages do any way? |
|
nope :-( |
|
@adepretis as mentioned by @freibuis this is the specific intent with ensure_packages. https://github.com/puppetlabs/puppetlabs-stdlib/blob/dce8d7b194e3f6d9bb24e076c6e835aeb671099a/lib/puppet/parser/functions/ensure_resource.rb So you may have hit a bug either in it's usage here or in the stdlib function. Could you provide details of how your triggering the issue, along with the logs from the agent run? |
|
It seems there is a problem with It works, no errors. As soon as it's done this way: The following error occurs: This error also occurs when using So it seems, as long as the conflicting package is used explicitly, without passing an array or using I don't know if it that is intended. My solution for know is to use |
|
Hm, ok, my solution doesn't work neither: results in the same error, only explicitly using doesn't conflict. Which leaves no working solution of defining an array of packages to be installed (using hiera or not) that does not conflict with |
|
@adepretis mmm, interesting. Could you open an issue against puppetlabs-stdlib at https://tickets.puppetlabs.com/browse/MODULES/. Might be something obvious I'm missing. @DavidS for reference. |
|
As a side note: when I remove By the way, I totally forget so metadata:
|
|
But now I'm totally confused. I did a little test-setup: and it results in an error |
|
Either change it to: |
|
What about adding a parameter that allows people to disable the ensure_packages for curl if it's causing issues (since in that case, they're managing it elsewhere in their code)? At least that doesn't use both defined and ensure_packages, which may not work in all cases anyway. So just something basic like: if $manage_curl { with $manage_curl defaulting to true (matches the existing $manage_service parameter). I can put in a PR if that would help (didn't want to do so with this open one until I got feedback). FWIW, we were able to resolve the duplicate definition by changing to the following in our code (the ensure => is not required, but this is a part of an iteration in reality, so the ensure is set explicitly): Note that 'installed' is the default, not 'present'. I had issues until I switched to using both 'installed' / only default values and the array syntax. |
I got the information that 'present' is the default from the function code itself.
This seems weird for me. From my tests, I noticed that declaring the same package with the same parameters would always work. BTW, pls check out this ticket and the related PR about the conflict between 'present' and 'installed'. |
|
Fair enough on the installed versus present - I was just going on the Puppet docs and didn't check the function: I went ahead and retested with the following results: No Duplicate: This was a little surprising for me (I tested twice to make sure). I'll add a note to the stdlib ticket you mentioned. Also, for the previous person looking to add multiple packages from Hiera, if you're still looking for a Hiera-enabled solution, this is working for us: Then $packages_linux can be a hash in Hiera (theoretically - we actually do our package list in code with overrides). |
Use system_test bundler args for docker GA runs
Curl is a very common package that will be most likely declared by custom modules too. This PR avoids conflicts with a curl package already declared by other modules (most likely custom modules).