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
: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