mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
[PR #8793/9c9c4cbc backport][stable-9] pipx/pipx_info: add parameter global
(#8807)
pipx/pipx_info: add parameter `global` (#8793)
* pipx/pipx_info: add new parameters
* add test for --global, refactor int test main file
* ensure initial state of test
* ensure PATH includes /usr/local/bin
* ensure PATH includes /usr/local/bin for entire block
* ensure minimum version of pip
* ensure pipx 1.6.0 is installed
* push recommendation for pipx 1.7.0 instead of 1.6.0
* add changelog frag
* add deprecatons to changelog frag
* add deprecatons to changelog frag, better
* Update changelogs/fragments/8793-pipx-global.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelogs/fragments/8793-pipx-global.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 9c9c4cbc3e
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
c58181bdc9
commit
b935dcedd8
11 changed files with 355 additions and 207 deletions
|
@ -47,14 +47,22 @@ options:
|
|||
If not specified, the module will use C(python -m pipx) to run the tool,
|
||||
using the same Python interpreter as ansible itself.
|
||||
type: path
|
||||
global:
|
||||
description:
|
||||
- The module will pass the C(--global) argument to C(pipx), to execute actions in global scope.
|
||||
- The C(--global) is only available in C(pipx>=1.6.0), so make sure to have a compatible version when using this option.
|
||||
Moreover, a nasty bug with C(--global) was fixed in C(pipx==1.7.0), so it is strongly recommended you used that version or newer.
|
||||
type: bool
|
||||
default: false
|
||||
version_added: 9.3.0
|
||||
notes:
|
||||
- This module requires C(pipx) version 0.16.2.1 or above. From community.general 11.0.0 onwards, the module will require C(pipx>=1.7.0).
|
||||
- Please note that C(pipx) requires Python 3.6 or above.
|
||||
- This module does not install the C(pipx) python package, however that can be easily done with the module M(ansible.builtin.pip).
|
||||
- This module does not require C(pipx) to be in the shell C(PATH), but it must be loadable by Python as a module.
|
||||
- >
|
||||
This module will honor C(pipx) environment variables such as but not limited to E(PIPX_HOME) and E(PIPX_BIN_DIR)
|
||||
passed using the R(environment Ansible keyword, playbooks_environment).
|
||||
- This module requires C(pipx) version 0.16.2.1 or above.
|
||||
- Please note that C(pipx) requires Python 3.6 or above.
|
||||
- See also the C(pipx) documentation at U(https://pypa.github.io/pipx/).
|
||||
author:
|
||||
- "Alexei Znamensky (@russoz)"
|
||||
|
@ -140,14 +148,16 @@ from ansible.module_utils.facts.compat import ansible_facts
|
|||
|
||||
class PipXInfo(ModuleHelper):
|
||||
output_params = ['name']
|
||||
argument_spec = dict(
|
||||
name=dict(type='str'),
|
||||
include_deps=dict(type='bool', default=False),
|
||||
include_injected=dict(type='bool', default=False),
|
||||
include_raw=dict(type='bool', default=False),
|
||||
executable=dict(type='path'),
|
||||
)
|
||||
argument_spec["global"] = dict(type='bool', default=False)
|
||||
module = dict(
|
||||
argument_spec=dict(
|
||||
name=dict(type='str'),
|
||||
include_deps=dict(type='bool', default=False),
|
||||
include_injected=dict(type='bool', default=False),
|
||||
include_raw=dict(type='bool', default=False),
|
||||
executable=dict(type='path'),
|
||||
),
|
||||
argument_spec=argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
use_old_vardict = False
|
||||
|
@ -195,7 +205,7 @@ class PipXInfo(ModuleHelper):
|
|||
|
||||
return results
|
||||
|
||||
with self.runner('_list', output_process=process_list) as ctx:
|
||||
with self.runner('_list global', output_process=process_list) as ctx:
|
||||
self.vars.application = ctx.run(_list=1)
|
||||
self._capture_results(ctx)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue