java icon indicating copy to clipboard operation
java copied to clipboard

openjdk_pkg_install reset_alternatives all the times

Open andrealai75 opened this issue 3 years ago • 2 comments

:speaking_head: Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

:ghost: Brief Description

The openjdk_pkg_install is resetting the alternatives all the times so a new install wipes out any previous installed Java alternatives.

The issue is that the custom resource openjdk_pkg_install is calling java_alternatives setting the reset_alternatives property from new_resource.reset_alternatives but this is not defined in the resource itself so always default to true.

The fix is very simple add the following to openjdk_pkg_install:

property :reset_alternatives, [true, false], default: true, description: 'Whether to reset alternatives before setting them'

I checked openjdk_source_install and we have similar problem there

:pancakes: Cookbook version

11.1.0

:woman_cook: Chef-Infra Version

Any.

:tophat: Platform details

Any

Steps To Reproduce

Create a recipe with two openjdk_pkg_install and only the last alternative is created.

:police_car: Expected behavior

We should have one alternative for each Java installed

:heavy_plus_sign: Additional context

None

andrealai75 avatar Aug 03 '22 16:08 andrealai75

Would you like to add the simple PR to fix this? We'll happily release it

damacus avatar May 09 '23 06:05 damacus

@andrealai75 it looks this was likely fixed in a recent version. Can you please verify that's the case?

ramereth avatar Mar 15 '24 21:03 ramereth