From 07953bb9952275d673e4a468e29e74fb7ede528b Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 21 Apr 2024 15:10:14 +0200 Subject: [PATCH] [PR #8236/be11d0d4 backport][stable-8] Add an explicit `select` option to `portage` module (#8259) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an explicit `select` option to `portage` module (#8236) * Add an explicit `select` option to `portage` module This is a fix for #6226 * Apply suggestions from code review Co-authored-by: Felix Fontein * Default `select` option to None, making it more retrocompatible * Add changelog fragment for the PR * Update changelogs/fragments/8236-portage-select-feature.yml Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein (cherry picked from commit be11d0d4091f87fb0cc0b2ecb947c0c037cf1f43) Co-authored-by: Thomas Langé --- changelogs/fragments/8236-portage-select-feature.yml | 2 ++ plugins/modules/portage.py | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 changelogs/fragments/8236-portage-select-feature.yml diff --git a/changelogs/fragments/8236-portage-select-feature.yml b/changelogs/fragments/8236-portage-select-feature.yml new file mode 100644 index 0000000000..742d5cc966 --- /dev/null +++ b/changelogs/fragments/8236-portage-select-feature.yml @@ -0,0 +1,2 @@ +minor_changes: + - portage - adds the possibility to explicitely tell portage to write packages to world file (https://github.com/ansible-collections/community.general/issues/6226, https://github.com/ansible-collections/community.general/pull/8236). diff --git a/plugins/modules/portage.py b/plugins/modules/portage.py index 112f6d2d7c..8ae8efb087 100644 --- a/plugins/modules/portage.py +++ b/plugins/modules/portage.py @@ -121,6 +121,14 @@ options: type: bool default: false + select: + description: + - If set to V(true), explicitely add the package to the world file. + - Please note that this option is not used for idempotency, it is only used + when actually installing a package. + type: bool + version_added: 8.6.0 + sync: description: - Sync package repositories first @@ -374,6 +382,7 @@ def emerge_packages(module, packages): 'loadavg': '--load-average', 'backtrack': '--backtrack', 'withbdeps': '--with-bdeps', + 'select': '--select', } for flag, arg in emerge_flags.items(): @@ -523,6 +532,7 @@ def main(): nodeps=dict(default=False, type='bool'), onlydeps=dict(default=False, type='bool'), depclean=dict(default=False, type='bool'), + select=dict(default=None, type='bool'), quiet=dict(default=False, type='bool'), verbose=dict(default=False, type='bool'), sync=dict(default=None, choices=['yes', 'web', 'no']), @@ -543,6 +553,7 @@ def main(): ['quiet', 'verbose'], ['quietbuild', 'verbose'], ['quietfail', 'verbose'], + ['oneshot', 'select'], ], supports_check_mode=True, )