From c2e578cb141e0a011380535a3374bc5fdc49aa87 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Sat, 11 Nov 2023 23:59:44 +1300 Subject: [PATCH] pipx: change parameter formatter for pip_args (#7506) * change parameter formatter for pip_args * add changelog frag --- changelogs/fragments/7506-pipx-pipargs.yml | 2 ++ plugins/module_utils/pipx.py | 2 +- tests/integration/targets/pipx/tasks/main.yml | 25 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/7506-pipx-pipargs.yml diff --git a/changelogs/fragments/7506-pipx-pipargs.yml b/changelogs/fragments/7506-pipx-pipargs.yml new file mode 100644 index 0000000000..014e189c84 --- /dev/null +++ b/changelogs/fragments/7506-pipx-pipargs.yml @@ -0,0 +1,2 @@ +bugfixes: + - pipx module utils - change the CLI argument formatter for the `pip_args` parameter (https://github.com/ansible-collections/community.general/issues/7497, https://github.com/ansible-collections/community.general/pull/7506). diff --git a/plugins/module_utils/pipx.py b/plugins/module_utils/pipx.py index 2f19f352d4..a385ec93e7 100644 --- a/plugins/module_utils/pipx.py +++ b/plugins/module_utils/pipx.py @@ -42,7 +42,7 @@ def pipx_runner(module, command, **kwargs): system_site_packages=fmt.as_bool("--system-site-packages"), _list=fmt.as_fixed(['list', '--include-injected', '--json']), editable=fmt.as_bool("--editable"), - pip_args=fmt.as_opt_val('--pip-args'), + pip_args=fmt.as_opt_eq_val('--pip-args'), ), environ_update={'USE_EMOJI': '0'}, check_rc=True, diff --git a/tests/integration/targets/pipx/tasks/main.yml b/tests/integration/targets/pipx/tasks/main.yml index 567405ec49..7eb0f11a6c 100644 --- a/tests/integration/targets/pipx/tasks/main.yml +++ b/tests/integration/targets/pipx/tasks/main.yml @@ -314,3 +314,28 @@ that: - install_tox_sitewide is changed - usrlocaltox.stat.exists + +############################################################################## +# Test for issue 7497 +- name: ensure application pyinstaller is uninstalled + community.general.pipx: + name: pyinstaller + state: absent + +- name: Install Python Package pyinstaller + community.general.pipx: + name: pyinstaller + state: present + system_site_packages: true + pip_args: "--no-cache-dir" + register: install_pyinstaller + +- name: cleanup pyinstaller + community.general.pipx: + name: pyinstaller + state: absent + +- name: check assertions + assert: + that: + - install_pyinstaller is changed