Skip to content
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

[PR #4557/29c49feb backport][stable-4] Add 'state' parameter for alternatives #4576

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Apr 26, 2022

This is a backport of PR #4557 as merged into main (29c49fe).

Allow alternatives to be installed without being set as the current selection. Fixes #4543.

SUMMARY

Adds a state parameter to the alternatives module with the following behavior:

  • When not set, or set to selected, the module behaves exactly as at present:
    • Every time this module runs, the alternative in question will be set as the current selection for the alternatives group
  • When set to present, the alternative will be installed, but not set as the current selection for the group.
    • If the the alternative was previously set to selected and is now set to present, the group will be set to use auto mode.

This change preserves existing behavior by default and allows the following behavior if state is set to present:

  • Auto mode can persist (presently manual mode is being forced)
  • Manual user selection of alternative is preserved across successive Ansible runs.
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

alternatives

ADDITIONAL INFORMATION

There is an example in the description of #4543.

A few questions:

  • Any better ideas for parameter names than activate? Update: changed to state.
  • Anyone else in favor of making selected = False the default behavior? At present, the PR preserves the existing default behavior, but to me it does not seem very useful.

* Add 'activate' parameter for alternatives

Allow alternatives to be installed without being set as the current
selection.

* add changelog fragment

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* rename 'activate' -> 'selected'

* rework 'selected' parameter -> 'state'

* handle unsetting of currently selected alternative

* add integration tests for 'state' parameter

* fix linting issues

* fix for Python 2.7 compatibility

* Remove alternatives file.

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 29c49fe)
@ansibullbot
Copy link
Collaborator

cc @mulby
click here for bot help

@ansibullbot ansibullbot added backport feature This issue/PR relates to a feature request integration tests/integration module module new_contributor Help guide this first time contributor plugins plugin (any type) system tests tests labels Apr 26, 2022
@felixfontein felixfontein merged commit 03b128a into stable-4 Apr 26, 2022
@felixfontein felixfontein deleted the patchback/backports/stable-4/29c49febd9fa726748b9f6771b77746c67d0028c/pr-4557 branch April 26, 2022 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request integration tests/integration module module new_contributor Help guide this first time contributor plugins plugin (any type) system tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants