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

pip module's new list-of-names feature (v2.2) breaks pip's "extras" #19131

Closed
akhayyat opened this issue Dec 9, 2016 · 5 comments
Closed

pip module's new list-of-names feature (v2.2) breaks pip's "extras" #19131

akhayyat opened this issue Dec 9, 2016 · 5 comments
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. module This issue/PR relates to a module. python3

Comments

@akhayyat
Copy link
Contributor

akhayyat commented Dec 9, 2016

ISSUE TYPE
  • Bug Report
COMPONENT NAME

pip

ANSIBLE VERSION
ansible 2.2.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION

No changes.

OS / ENVIRONMENT

Debian GNU/Linux testing (stretch)

SUMMARY

With the new support for list of names in 2.2, listing pip-supported setuptools "extras" is broken. "extras" are optional package features. See example 6 in pip examples and Declaring “Extras” (optional features with their own dependencies) in setuptools documentation for more information on "extras".

Moved from ansible/ansible-modules-core#5843.

STEPS TO REPRODUCE
- hosts: localhost
  tasks:
    - pip: name=buildbot[bundle,tls] version=0.9.1
EXPECTED RESULTS

buildbot==0.9.1 is installed with the bundle and tls extras/options. This works with pre-2.2 versions of Ansible.

ACTUAL RESULTS

The comma separating the extras is instead interpreted as separating multiple python packages for pip to install: Invalid requirement: 'buildbot[bundle==0.9.1.

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

TASK [setup] *******************************************************************
ok: [localhost]

TASK [pip] *********************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "/usr/bin/pip2 install buildbot[bundle==0.9.1 tls]==0.9.1", "failed": true, "msg": "\n:stderr: Invalid requirement: 'buildbot[bundle==0.9.1'\nTraceback (most recent call last):\n  File \"/usr/lib/python2.7/dist-packages/pip/req/req_install.py\", line 82, in __init__\n    req = Requirement(req)\n  File \"/usr/share/python-wheels/packaging-16.8-py2.py3-none-any.whl/packaging/requirements.py\", line 94, in __init__\n    requirement_string[e.loc:e.loc + 8]))\nInvalidRequirement: Invalid requirement, parse error at \"'[bundle='\"\n\n"}
        to retry, use: --limit @/home/ahmad/local/test/ansible/pip.retry

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1
@ansibot ansibot added affects_2.2 This issue/PR affects Ansible v2.2 bug_report module This issue/PR relates to a module. labels Dec 13, 2016
@ansibot
Copy link
Contributor

ansibot commented Dec 19, 2016

@jimi-c jimi-c removed the plugin label Jan 4, 2017
@ansibot ansibot added the python3 label Feb 7, 2017
@akhayyat
Copy link
Contributor Author

Any plans for fixing this issue? This bug introduces a backwards incompatibility. A working configuration for Ansible 2.1 does not work with any >=2.2.0 version. At the same time, some third-party roles require >=2.2.0 versions!

I looked at the code, but could not easily see a straightforward way to fix this bug. Lists are parsed in a generic way that is not specific to this module.

Perhaps that generic list parsing should ignore comas enclosed in any type of parentheses? Would that break anything else?

@bcoca
Copy link
Member

bcoca commented Mar 14, 2017

so this is a consequence of pip being able to take a 'list of packages' now, you should be able to work around it by avoiding the k=v syntax:

- hosts: localhost
  tasks:
    - pip: 
        name:
            - 'buildbot[bundle,tls]'
        version: 0.9.1

@akhayyat
Copy link
Contributor Author

That worked! Thanks @bcoca

@abadger abadger closed this as completed Mar 25, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@Cryolite
Copy link

On Ansible 2.7, even the workaround described in #19131 (comment) does not seem to work.

@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. module This issue/PR relates to a module. python3
Projects
None yet
Development

No branches or pull requests

6 participants