-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'state' parameter for alternatives #4557
Merged
felixfontein
merged 10 commits into
ansible-collections:main
from
tprestegard:alternatives-optional-activate
Apr 26, 2022
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7ef07f8
Add 'activate' parameter for alternatives
tprestegard f8a9531
add changelog fragment
tprestegard 8a19fcf
Apply suggestions from code review
tprestegard f393a12
rename 'activate' -> 'selected'
tprestegard 272275c
rework 'selected' parameter -> 'state'
tprestegard 4257962
handle unsetting of currently selected alternative
tprestegard f3952f9
add integration tests for 'state' parameter
tprestegard 9ffd3b2
fix linting issues
tprestegard 45fe436
fix for Python 2.7 compatibility
tprestegard 6ac7eb1
Remove alternatives file.
felixfontein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix for Python 2.7 compatibility
- Loading branch information
commit 45fe43619657c434a38da1f52f4fda15512d0d2f
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit of a nit-picking but I think both terms in the name should be plural:
choices=AlternativeState.to_list()
sounds quite odd - to me at least.Also I think we might want to consider prefixing that class name with a
_
, so that it doesn't become a public symbol. By being public, any change we make later on will require a long deprecation period.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many arguments for and against using a plural vs. a singular name for an enumeration. Java and C# seem to prefer singular names (https://stackoverflow.com/a/15756009). I guess in the end it's a matter of taste.
I wouldn't consider modules (as opposed to module_utils etc.) a public API. The guidelines only talk about public/private module and plugin utils. Maybe we should discuss this in community-topics...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. I reckon this is not a show stopper.