feat: Add skip_alternatives (@dschlenk) - #727
Merged
Merged
Conversation
- 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>
There was a problem hiding this comment.
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_alternativesproperty 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_alternativesis true, none of thealternativesblocks 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_alternativessetting is being declared as a resource property but never used by the Chefalternativesresource. 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
alternativesresource, not a property. Usenot_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 whenskip_alternativesis 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 unsupportedskip_alternativesproperty to the Chefalternativesresource.
skip_alternatives new_resource.skip_alternatives
resources/corretto_install.rb:75
- Replacing
action :setwith this guard removes the explicit:setaction. Either restoreaction :setand addnot_if { new_resource.skip_alternatives }above it, or confirm the default action covers the intended behavior.
not_if { new_resource.skip_alternatives }
Contributor
|
Released as: 13.1.0 |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Credit to @dschlenk for the new property. Pulled it into a new pull request so we don't have to rebase.
Thanks!