mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
pipx - fixed bug in state=inject (#3611)
* pipx - fixed bug in state=inject * added changelog fragment * copy/paste error in the integration test * replaced injected package with simpler one * testing force_lang = None * disable UTF-8 emojis in pipx output * better way to achieve the same outcome * Adjsuted the changelog fragment
This commit is contained in:
parent
8ba7fd5d61
commit
40ccd1501b
3 changed files with 41 additions and 1 deletions
3
changelogs/fragments/3611-pipx-fix-inject.yml
Normal file
3
changelogs/fragments/3611-pipx-fix-inject.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
bugfixes:
|
||||
- pipx - ``state=inject`` was failing to parse the list of injected packages (https://github.com/ansible-collections/community.general/pull/3611).
|
||||
- pipx - set environment variable ``USE_EMOJI=0`` to prevent errors in platforms that do not support ``UTF-8`` (https://github.com/ansible-collections/community.general/pull/3611).
|
|
@ -176,6 +176,9 @@ class PipX(CmdStateModuleHelper):
|
|||
_list=dict(fmt=('list', '--include-injected', '--json'), style=ArgFormat.BOOLEAN),
|
||||
)
|
||||
check_rc = True
|
||||
run_command_fixed_options = dict(
|
||||
environ_update={'USE_EMOJI': '0'}
|
||||
)
|
||||
|
||||
def _retrieve_installed(self):
|
||||
def process_list(rc, out, err):
|
||||
|
@ -188,7 +191,7 @@ class PipX(CmdStateModuleHelper):
|
|||
results[venv_name] = {
|
||||
'version': venv['metadata']['main_package']['package_version'],
|
||||
'injected': dict(
|
||||
(k, v['package_version']) for k, v in venv['metadata']['injected_packages']
|
||||
(k, v['package_version']) for k, v in venv['metadata']['injected_packages'].items()
|
||||
),
|
||||
}
|
||||
return results
|
||||
|
|
|
@ -90,3 +90,37 @@
|
|||
- downgrade_tox_324.application.tox.version == '3.24.0'
|
||||
- uninstall_tox_324 is changed
|
||||
- "'tox' not in uninstall_tox_324.application"
|
||||
|
||||
##############################################################################
|
||||
- name: ensure application ansible-lint is uninstalled
|
||||
community.general.pipx:
|
||||
name: ansible-lint
|
||||
state: absent
|
||||
|
||||
- name: install application ansible-lint
|
||||
community.general.pipx:
|
||||
name: ansible-lint
|
||||
register: install_ansible_lint
|
||||
|
||||
- name: inject packages
|
||||
community.general.pipx:
|
||||
state: inject
|
||||
name: ansible-lint
|
||||
inject_packages:
|
||||
- licenses
|
||||
register: inject_pkgs_ansible_lint
|
||||
|
||||
- name: cleanup ansible-lint
|
||||
community.general.pipx:
|
||||
state: absent
|
||||
name: ansible-lint
|
||||
register: uninstall_ansible_lint
|
||||
|
||||
- name: check assertions inject_packages
|
||||
assert:
|
||||
that:
|
||||
- install_ansible_lint is changed
|
||||
- inject_pkgs_ansible_lint is changed
|
||||
- '"ansible-lint" in inject_pkgs_ansible_lint.application'
|
||||
- '"licenses" in inject_pkgs_ansible_lint.application["ansible-lint"]["injected"]'
|
||||
- uninstall_ansible_lint is changed
|
||||
|
|
Loading…
Reference in a new issue