Skip to content

feat: Add skip_alternatives (@dschlenk) - #727

Merged
damacus merged 1 commit into
mainfrom
skip_alternatives
Jul 14, 2025
Merged

feat: Add skip_alternatives (@dschlenk)#727
damacus merged 1 commit into
mainfrom
skip_alternatives

Conversation

@damacus

@damacus damacus commented Jul 14, 2025

Copy link
Copy Markdown
Member
  • Add skip_alternatives for cases when management of alternatives is not desired
  • Update documentation for resources

Credit to @dschlenk for the new property. Pulled it into a new pull request so we don't have to rebase.

Thanks!

- Add skip_alternatives for cases when management of alternatives is not desired
- Update documentation for resources

Signed-off-by: Dan Webb <dan.webb@damacus.io>
@damacus
damacus requested a review from a team as a code owner July 14, 2025 08:33
@damacus damacus self-assigned this Jul 14, 2025
@damacus
damacus requested a review from Copilot July 14, 2025 08:34
@damacus damacus added the Release: Minor Release to Chef Supermarket as a minor release when merged label Jul 14, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new skip_alternatives property to allow skipping Chef alternatives management across several Java installation resources and updates corresponding documentation and the changelog.

  • Add skip_alternatives property in the common partial
  • Guard alternatives resource blocks with skip_alternatives
  • Update resource documentation and changelog

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
resources/partial/_common.rb Added skip_alternatives property to shared resource definitions
resources/temurin_package_install.rb Added not_if { new_resource.skip_alternatives } guards
resources/openjdk_source_install.rb Added not_if { new_resource.skip_alternatives } to set/unset blocks
resources/openjdk_pkg_install.rb Introduced skip_alternatives property (incorrect usage)
resources/openjdk_install.rb Added skip_alternatives lines in multiple alternatives blocks
resources/corretto_install.rb Replaced action :set with a guard but lost explicit action
documentation/resources/*.md Documented new skip_alternatives property in all resource docs
CHANGELOG.md Added entry for skip_alternatives feature
Comments suppressed due to low confidence (8)

resources/partial/_common.rb:5

  • Add or update tests to verify that when skip_alternatives is true, none of the alternatives blocks execute across all resources.
property :skip_alternatives, [true, false],

documentation/resources/temurin_package_install.md:26

  • [nitpick] For consistency with other documentation tables, wrap the default value (false) in backticks.
| `skip_alternatives`   | Boolean        | false                                  | Skip alternatives installation completely    |

resources/openjdk_pkg_install.rb:55

  • The skip_alternatives setting is being declared as a resource property but never used by the Chef alternatives resource. Replace this line with a guard: not_if { new_resource.skip_alternatives } at the block level so the alternatives resource is skipped when requested.
    skip_alternatives new_resource.skip_alternatives

resources/openjdk_install.rb:50

  • This should be a guard on the alternatives resource, not a property. Use not_if { new_resource.skip_alternatives } before the block to prevent alternatives management when skipped.
      skip_alternatives new_resource.skip_alternatives

resources/openjdk_install.rb:63

  • Apply not_if { new_resource.skip_alternatives } guard here to skip the unset action when skip_alternatives is true, instead of declaring it as a resource property.
      skip_alternatives new_resource.skip_alternatives

resources/openjdk_install.rb:80

  • Convert this line into a guard: not_if { new_resource.skip_alternatives }, so the remove action on alternatives is skipped when requested.
      skip_alternatives new_resource.skip_alternatives

resources/openjdk_install.rb:94

  • Use a guard (not_if { new_resource.skip_alternatives }) rather than adding an unsupported skip_alternatives property to the Chef alternatives resource.
      skip_alternatives new_resource.skip_alternatives

resources/corretto_install.rb:75

  • Replacing action :set with this guard removes the explicit :set action. Either restore action :set and add not_if { new_resource.skip_alternatives } above it, or confirm the default action covers the intended behavior.
    not_if { new_resource.skip_alternatives }

@damacus
damacus merged commit c1e613b into main Jul 14, 2025
60 checks passed
@damacus
damacus deleted the skip_alternatives branch July 14, 2025 08:37
@kitchen-porter

Copy link
Copy Markdown
Contributor

Released as: 13.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release: Minor Release to Chef Supermarket as a minor release when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants