pipx/pipx_info: refactor doc fragment (#8859)

* pipx/pipx_info: refactor doc fragment

* pipx/pipx_info: refactor common options to module_utils
This commit is contained in:
Alexei Znamensky 2024-09-14 19:27:12 +12:00 committed by GitHub
parent 76ebda7faf
commit e4472b322b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 60 additions and 57 deletions

View file

@ -19,6 +19,7 @@ description:
extends_documentation_fragment:
- community.general.attributes
- community.general.attributes.info_module
- community.general.pipx
options:
name:
description:
@ -40,30 +41,8 @@ options:
- The raw output is not affected by O(include_deps) or O(include_injected).
type: bool
default: false
executable:
description:
- Path to the C(pipx) installed in the system.
- >
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).
- See also the C(pipx) documentation at U(https://pypa.github.io/pipx/).
author:
- "Alexei Znamensky (@russoz)"
'''
@ -141,7 +120,7 @@ cmd:
import json
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
from ansible_collections.community.general.plugins.module_utils.pipx import pipx_runner
from ansible_collections.community.general.plugins.module_utils.pipx import pipx_runner, pipx_common_argspec
from ansible.module_utils.facts.compat import ansible_facts
@ -153,9 +132,8 @@ class PipXInfo(ModuleHelper):
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)
argument_spec.update(pipx_common_argspec)
module = dict(
argument_spec=argument_spec,
supports_check_mode=True,