Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipx module: --pip-args: expected one argument #7497

Closed
1 task done
sedrubal opened this issue Nov 7, 2023 · 4 comments · Fixed by #7506
Closed
1 task done

pipx module: --pip-args: expected one argument #7497

sedrubal opened this issue Nov 7, 2023 · 4 comments · Fixed by #7506
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type)

Comments

@sedrubal
Copy link
Contributor

sedrubal commented Nov 7, 2023

Summary

When specifying pip_args for the pipx module, e.g. pip_args: --no-cache-dir, they are passed as two arguments to pipx while execution:

fatal: [mmx-sync.mmx.musc.intra]: FAILED! => changed=false 
  cmd: |-
    /usr/bin/python3 -m pipx install --pip-args --no-cache-dir my_pkg
...

However, they must be passed as one argument. The cmd should look like this:

/usr/bin/python3 -m pipx install --pip-args="--no-cache-dir" my_pkg

Issue Type

Bug Report

Component Name

pipx

Ansible Version

$ ansible --version
ansible [core 2.12.10]
  config file = /home/endr_se/Documents/mmx/ansible/ansible.cfg
  configured module search path = ['/home/endr_se/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/endr_se/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, May 26 2023, 14:05:08) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
# /usr/lib/python3/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.8.3  

# /home/user/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 8.0.1

Configuration

$ ansible-config dump --only-changed
ANSIBLE_NOCOWS(/home/user/Documents/ansible/ansible.cfg) = True
ANSIBLE_PIPELINING(/home/user/Documents/mmx/ansible/ansible.cfg) = True
DEFAULT_HOST_LIST(/home/user/Documents/mmx/ansible/ansible.cfg) = ['/home/user/Documents/ansible/inventory.yml']
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/user/Documents/ansible/ansible.cfg) = True
DEFAULT_ROLES_PATH(/home/user/Documents/ansible/ansible.cfg) = ['/home/user/Documents/ansible/roles', '/home/user/Documents/ansible/roles-common']
DEFAULT_STDOUT_CALLBACK(/home/user/Documents/ansible/ansible.cfg) = community.general.yaml
DIFF_ALWAYS(/home/user/Documents/ansible/ansible.cfg) = True

OS / Environment

Ubuntu 20.04 LTS

Steps to Reproduce

---
- hosts: localhost
  gather_facts: false
  become: false
  tasks:
    - name: Install Python Package pyinstaller
      community.general.pipx:
        name: pyinstaller
        state: present
        system_site_packages: true
        pip_args: "--no-cache-dir"

Expected Results

--no-cache-dir should be passed to pip.

Actual Results

ansible-playbook test-pb.yml
[WARNING]: Collection community.general does not support Ansible version 2.12.10

PLAY [localhost] ********************************************************************************************************************

TASK [Install Python Package pyinstaller] *******************************************************************************************
fatal: [localhost]: FAILED! => changed=false 
  cmd: /usr/bin/python3 -m pipx install --system-site-packages --pip-args --no-cache-dir pyinstaller
  msg: |-
    usage: /usr/bin/python3 -m pipx install [-h] [--include-deps] [--verbose]
                                            [--force] [--suffix SUFFIX]
                                            [--python PYTHON]
                                            [--system-site-packages]
                                            [--index-url INDEX_URL] [--editable]
                                            [--pip-args PIP_ARGS]
                                            package_spec
    /usr/bin/python3 -m pipx install: error: argument --pip-args: expected one argument
  rc: 2
  stderr: |-
    usage: /usr/bin/python3 -m pipx install [-h] [--include-deps] [--verbose]
                                            [--force] [--suffix SUFFIX]
                                            [--python PYTHON]
                                            [--system-site-packages]
                                            [--index-url INDEX_URL] [--editable]
                                            [--pip-args PIP_ARGS]
                                            package_spec
    /usr/bin/python3 -m pipx install: error: argument --pip-args: expected one argument
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>

PLAY RECAP **************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

cc @russoz
click here for bot help

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Nov 7, 2023
@russoz
Copy link
Collaborator

russoz commented Nov 9, 2023

Hi @sedrubal thanks for reporting it. I believe I know how to fix it but I am having some very busy days, it's gonna take a couple of days to go through it.

@russoz
Copy link
Collaborator

russoz commented Nov 9, 2023

Or much less than that ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants