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 raises NameError: global name 'virtualenv' is not defined when using extra_args #5601

Closed
robmadole opened this issue Jan 13, 2014 · 3 comments
Labels
bug This issue/PR relates to a bug.

Comments

@robmadole
Copy link

I have confirmed this issue on version 1.4.4. It previously worked on 1.4.3.

The following example task:

- name: Install the web app in development mode
  pip: executable=pip-3.3 name=/path/to/code extra_args='-e'

Raises the following error:

Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-1389641998.4-98108193785888/pip", line 1381, in <module>
    main()
  File "/home/vagrant/.ansible/tmp/ansible-1389641998.4-98108193785888/pip", line 325, in main
    cmd_opts = _get_cmd_options(module, cmd)
  File "/home/vagrant/.ansible/tmp/ansible-1389641998.4-98108193785888/pip", line 152, in _get_cmd_options
    module.fail_json(msg="Could not get --help output from %s" % virtualenv)
NameError: global name 'virtualenv' is not defined

I believe the root problem is that _get_cmd_options function is being called with a cmd argument of pip3.3 -e. This results in the value of thiscmd being pip3.3 -e --help when ran (on line 149) which fails.

The -e gets thrown onto the cmd on this line.

@robmadole
Copy link
Author

I believe this may be relevant to #4601.

@jctanner
Copy link
Contributor

@robmadole the patch above was tested with the following playbook:

- hosts: el6.lab.net
  gather_facts: False
  tasks:
    - pip: name=bottle extra_args='-v'
    - pip: name='git+git@github.com:succhiello/ansible-playbook-wrapper.git#egg=ansible-playbook-wrapper' extra_args='-e'

@robmadole
Copy link
Author

Perfect, thanks @jctanner!

jimi-c pushed a commit that referenced this issue Dec 6, 2016
I broke backwards compat with the addition to define when a password
should be updated. It was requiring that a password value be passed when
deleting a user, which seems silly.

This moves the argument logic out of the argument spec and into when it
would be needed, when state is present.
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants