mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-30 16:41:21 -07:00
pipx/pipx_info: multiple fixes (#9044)
* pipx_info: factored process_list out * pipx_info: no need to pass param to _list * pipx_info: minor adjustment * pipx mod utils: make_process_list parameters * fix test for state=install_all * fix assertions * pipx tests: fix detection of pipx 1.7.0 * pipx: use make_process_output * add testcase * pipx: remove import json * pinned in pipx list is not always there * Update plugins/modules/pipx_info.py Co-authored-by: Felix Fontein <felix@fontein.de> * remove ensurepath and --user from pipx install * add changelog frag * Update changelogs/fragments/9044-pipx-fixes.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/9044-pipx-fixes.yml * Update changelogs/fragments/9044-pipx-fixes.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/9044-pipx-fixes.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
c8410a924e
commit
2429e228a4
12 changed files with 165 additions and 176 deletions
|
@ -3,10 +3,22 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: install pipx
|
||||
pip:
|
||||
name: pipx
|
||||
extra_args: --user
|
||||
- name: Determine pipx level
|
||||
block:
|
||||
- name: Install pipx>=1.7.0
|
||||
pip:
|
||||
name: pipx>=1.7.0
|
||||
- name: Set has_pipx170 fact true
|
||||
ansible.builtin.set_fact:
|
||||
has_pipx170: true
|
||||
rescue:
|
||||
- name: Set has_pipx170 fact false
|
||||
ansible.builtin.set_fact:
|
||||
has_pipx170: false
|
||||
- name: Install pipx (no version spec)
|
||||
pip:
|
||||
name: pipx
|
||||
|
||||
|
||||
##############################################################################
|
||||
- name: ensure application tox is uninstalled
|
||||
|
@ -233,26 +245,21 @@
|
|||
- name: Include testcase for issue 8656
|
||||
ansible.builtin.include_tasks: testcase-8656.yml
|
||||
|
||||
- name: install pipx
|
||||
pip:
|
||||
name: pipx>=1.7.0
|
||||
extra_args: --user
|
||||
ignore_errors: true
|
||||
register: pipx170_install
|
||||
|
||||
- name: Recent features
|
||||
when:
|
||||
- pipx170_install is not failed
|
||||
- pipx170_install is changed
|
||||
- has_pipx170
|
||||
block:
|
||||
- name: Include testcase for PR 8793 --global
|
||||
ansible.builtin.include_tasks: testcase-8793-global.yml
|
||||
|
||||
- name: Include testcase for PR 8809 install-all
|
||||
ansible.builtin.include_tasks: testcase-8809-install-all.yml
|
||||
ansible.builtin.include_tasks: testcase-8809-installall.yml
|
||||
|
||||
- name: Include testcase for PR 8809 pin
|
||||
ansible.builtin.include_tasks: testcase-8809-pin.yml
|
||||
|
||||
- name: Include testcase for PR 8809 injectpkg
|
||||
ansible.builtin.include_tasks: testcase-8809-uninjectpkg.yml
|
||||
|
||||
- name: Include testcase for PR 9009 injectpkg --global
|
||||
ansible.builtin.include_tasks: testcase-9009-fixglobal.yml
|
||||
|
|
|
@ -24,10 +24,39 @@
|
|||
- pycowsay
|
||||
register: uninstall_all_1
|
||||
|
||||
- name: Install pycowsay and black
|
||||
community.general.pipx:
|
||||
state: install
|
||||
name: "{{ item }}"
|
||||
loop:
|
||||
- black
|
||||
- pycowsay
|
||||
register: install_all_1
|
||||
|
||||
- name: Generate JSON spec
|
||||
community.general.pipx_info:
|
||||
include_raw: true
|
||||
register: pipx_list
|
||||
|
||||
- name: Copy content
|
||||
ansible.builtin.copy:
|
||||
content: "{{ pipx_list.raw_output }}"
|
||||
dest: "{{ remote_tmp_dir }}/spec.json"
|
||||
mode: "0644"
|
||||
|
||||
- name: Uninstall pycowsay and black (again)
|
||||
community.general.pipx:
|
||||
state: uninstall
|
||||
name: "{{ item }}"
|
||||
loop:
|
||||
- black
|
||||
- pycowsay
|
||||
register: uninstall_all_2
|
||||
|
||||
- name: Use install-all
|
||||
community.general.pipx:
|
||||
state: install-all
|
||||
spec_metadata: spec.json
|
||||
state: install_all
|
||||
spec_metadata: "{{ remote_tmp_dir }}/spec.json"
|
||||
register: install_all
|
||||
|
||||
- name: Run pycowsay (should succeed)
|
||||
|
@ -47,13 +76,14 @@
|
|||
loop:
|
||||
- black
|
||||
- pycowsay
|
||||
register: uninstall_all_2
|
||||
register: uninstall_all_3
|
||||
|
||||
- name: Assert uninstall-all
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- uninstall_all_1 is not changed
|
||||
- install_all_1 is changed
|
||||
- uninstall_all_2 is changed
|
||||
- install_all is changed
|
||||
- "'Moooooooo!' in what_the_cow_said.stdout"
|
||||
- "'/usr/local/bin/pycowsay' in which_cow.stdout"
|
||||
- uninstall_all_2 is changed
|
||||
- uninstall_all_3 is changed
|
||||
|
|
|
@ -60,10 +60,10 @@
|
|||
- pycowsay
|
||||
register: uninstall_all_2
|
||||
|
||||
- name: Assert uninstall-all
|
||||
- name: Assert pin/unpin
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- pin_cow is changed
|
||||
- cow_info_1 == "0.0.0.1"
|
||||
- cow_info_1.application.0.version == "0.0.0.1"
|
||||
- unpin_cow is changed
|
||||
- cow_info_2 != "0.0.0.1"
|
||||
- cow_info_2.application.0.version != "0.0.0.1"
|
||||
|
|
|
@ -64,6 +64,6 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- pin_cow is changed
|
||||
- cow_info_1 == "0.0.0.1"
|
||||
- cow_info_1.application.0.version == "0.0.0.1"
|
||||
- unpin_cow is changed
|
||||
- cow_info_2 != "0.0.0.1"
|
||||
- cow_info_2.application.0.version != "0.0.0.1"
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: 9009-Ensure application pylint is uninstalled
|
||||
community.general.pipx:
|
||||
name: pylint
|
||||
state: absent
|
||||
global: true
|
||||
|
||||
- name: 9009-Install application pylint
|
||||
community.general.pipx:
|
||||
name: pylint
|
||||
global: true
|
||||
register: install_pylint
|
||||
|
||||
- name: 9009-Inject packages
|
||||
community.general.pipx:
|
||||
state: inject
|
||||
name: pylint
|
||||
global: true
|
||||
inject_packages:
|
||||
- licenses
|
||||
|
||||
- name: 9009-Ensure application pylint is uninstalled
|
||||
community.general.pipx:
|
||||
name: pylint
|
||||
state: absent
|
||||
global: true
|
Loading…
Add table
Add a link
Reference in a new issue