1
0
Fork 0
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) (#3634)

* 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

(cherry picked from commit 40ccd1501b)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2021-10-30 08:30:13 +02:00 committed by GitHub
parent ad93c40d40
commit 6959847701
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 1 deletions

View 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).

View file

@ -176,6 +176,9 @@ class PipX(CmdStateModuleHelper):
_list=dict(fmt=('list', '--include-injected', '--json'), style=ArgFormat.BOOLEAN), _list=dict(fmt=('list', '--include-injected', '--json'), style=ArgFormat.BOOLEAN),
) )
check_rc = True check_rc = True
run_command_fixed_options = dict(
environ_update={'USE_EMOJI': '0'}
)
def _retrieve_installed(self): def _retrieve_installed(self):
def process_list(rc, out, err): def process_list(rc, out, err):
@ -188,7 +191,7 @@ class PipX(CmdStateModuleHelper):
results[venv_name] = { results[venv_name] = {
'version': venv['metadata']['main_package']['package_version'], 'version': venv['metadata']['main_package']['package_version'],
'injected': dict( '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 return results

View file

@ -90,3 +90,37 @@
- downgrade_tox_324.application.tox.version == '3.24.0' - downgrade_tox_324.application.tox.version == '3.24.0'
- uninstall_tox_324 is changed - uninstall_tox_324 is changed
- "'tox' not in uninstall_tox_324.application" - "'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