From 33093e9f3e92d2facada017e9927c3303b56918f Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Wed, 29 Mar 2023 22:28:24 -0700 Subject: [PATCH] pipx: document parameters supported with state=latest, and fix include_injected parameter (#6212) * pipx: Document parameters supported with state=latest * pipx: Support "include_injected" with states "upgrade" and "latest" - Contrary to documentation, "include_injected" doesn't appear to have worked with state=upgrade since it was introduced. - Add support for include_injected with "latest", since "latest" is specified as being install+upgrade. * Add changelog fragment * Update plugins/modules/pipx.py Co-authored-by: Felix Fontein * Update changelog fragment Co-authored-by: Felix Fontein * pipx: Update to correct target release of community.general --------- Co-authored-by: Felix Fontein --- .../fragments/6212-pipx-include-injected.yml | 2 ++ plugins/modules/pipx.py | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 changelogs/fragments/6212-pipx-include-injected.yml diff --git a/changelogs/fragments/6212-pipx-include-injected.yml b/changelogs/fragments/6212-pipx-include-injected.yml new file mode 100644 index 0000000000..cfe85d9326 --- /dev/null +++ b/changelogs/fragments/6212-pipx-include-injected.yml @@ -0,0 +1,2 @@ +minor_changes: + - pipx - ensure ``include_injected`` parameter works with ``state=upgrade`` and ``state=latest`` (https://github.com/ansible-collections/community.general/pull/6212). diff --git a/plugins/modules/pipx.py b/plugins/modules/pipx.py index 343d3d5771..3f35696832 100644 --- a/plugins/modules/pipx.py +++ b/plugins/modules/pipx.py @@ -57,7 +57,7 @@ options: install_deps: description: - Include applications of dependent packages. - - Only used when I(state=install), I(state=upgrade), or I(state=inject). + - Only used when I(state=install), I(state=latest), I(state=upgrade), or I(state=inject). type: bool default: false inject_packages: @@ -69,24 +69,25 @@ options: force: description: - Force modification of the application's virtual environment. See C(pipx) for details. - - Only used when I(state=install), I(state=upgrade), I(state=upgrade_all), or I(state=inject). + - Only used when I(state=install), I(state=upgrade), I(state=upgrade_all), I(state=latest), or I(state=inject). type: bool default: false include_injected: description: - Upgrade the injected packages along with the application. - - Only used when I(state=upgrade) or I(state=upgrade_all). + - Only used when I(state=upgrade), I(state=upgrade_all), or I(state=latest). + - This is used with I(state=upgrade) and I(state=latest) since community.general 6.6.0. type: bool default: false index_url: description: - Base URL of Python Package Index. - - Only used when I(state=install), I(state=upgrade), or I(state=inject). + - Only used when I(state=install), I(state=upgrade), I(state=latest), or I(state=inject). type: str python: description: - Python version to be used when creating the application virtual environment. Must be 3.6+. - - Only used when I(state=install), I(state=reinstall), or I(state=reinstall_all). + - Only used when I(state=install), I(state=latest), I(state=reinstall), or I(state=reinstall_all). type: str executable: description: @@ -254,7 +255,7 @@ class PipX(StateModuleHelper): if self.vars.force: self.changed = True - with self.runner('state index_url install_deps force editable pip_args name', check_mode_skip=True) as ctx: + with self.runner('state include_injected index_url install_deps force editable pip_args name', check_mode_skip=True) as ctx: ctx.run() self._capture_results(ctx) @@ -307,7 +308,7 @@ class PipX(StateModuleHelper): ctx.run(state='install', name_source=[self.vars.name, self.vars.source]) self._capture_results(ctx) - with self.runner('state index_url install_deps force editable pip_args name', check_mode_skip=True) as ctx: + with self.runner('state include_injected index_url install_deps force editable pip_args name', check_mode_skip=True) as ctx: ctx.run(state='upgrade') self._capture_results(ctx)