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

easy_install fails to install pip with `ok` #16519

Closed
jayenashar opened this Issue Jun 30, 2016 · 6 comments

Comments

Projects
None yet
6 participants
@jayenashar

jayenashar commented Jun 30, 2016

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible 2.1.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

I also tried this on 1.9.4 before upgrading.

CONFIGURATION

pipelining = True

OS / ENVIRONMENT

CentOS release 6.7 amd64 managing CentOS release 6.7 amd64

SUMMARY

tried to easy_install pip. kept saying "ok" even though it didn't seem to install it (and it wasn't installed). added sudo: yes to make it say "changed" (and pip was installed).

STEPS TO REPRODUCE

The example playbook does not install pip and then the pip command fails. Failed to find required executable pip

    - easy_install: name=pip state=latest
    - pip: name=python-augeas
EXPECTED RESULTS

I expected easy_install to fail.

ACTUAL RESULTS
TASK [easy_install] ************************************************************
task path: /home/jayen/ansible-playbooks/hosts.yaml:7
<bigbang.buzzhives.com> ESTABLISH SSH CONNECTION FOR USER: None
<bigbang.buzzhives.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/jayen/.ansible/cp/ansible-ssh-%h-%p-%r bigbang.buzzhives.com '/bin/sh -c '"'"'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python && sleep 0'"'"''
ok: [bigbang.buzzhives.com] => {"binary": "/usr/bin/easy_install", "changed": false, "invocation": {"module_args": {"executable": "easy_install", "name": "pip", "state": "latest", "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_site_packages": false}, "module_name": "easy_install"}, "name": "pip", "virtualenv": null}

TASK [pip] *********************************************************************
task path: /home/jayen/ansible-playbooks/hosts.yaml:8
<bigbang.buzzhives.com> ESTABLISH SSH CONNECTION FOR USER: None
<bigbang.buzzhives.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/jayen/.ansible/cp/ansible-ssh-%h-%p-%r bigbang.buzzhives.com '/bin/sh -c '"'"'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python && sleep 0'"'"''
fatal: [bigbang.buzzhives.com]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"chdir": null, "editable": true, "executable": null, "extra_args": null, "name": "python-augeas", "requirements": null, "state": "present", "umask": null, "use_mirrors": true, "version": null, "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false}, "module_name": "pip"}, "msg": "Failed to find required executable pip"}

@jctanner jctanner added the bug_report label Jun 30, 2016

@jctanner

This comment has been minimized.

Show comment
Hide comment
@jctanner

jctanner Jun 30, 2016

Member

@jayenashar Please add this task after the easy_install task and provide the -vvvv output ...

- shell: which easy_install ; easy_install -m pip
Member

jctanner commented Jun 30, 2016

@jayenashar Please add this task after the easy_install task and provide the -vvvv output ...

- shell: which easy_install ; easy_install -m pip

@jctanner jctanner added the needs_info label Jun 30, 2016

@jctanner

This comment has been minimized.

Show comment
Hide comment
@jctanner

jctanner Jun 30, 2016

Member

note: this should be moved to the ansible-modules-core repo per https://github.com/ansible/ansible/blob/devel/ticket_stubs/module_repo.md but i'm letting it stay here until we know which module is at fault. I suspect easy_install believes pip is installed but doesn't know it hasn't been put into a location that is part of $PATH.

Member

jctanner commented Jun 30, 2016

note: this should be moved to the ansible-modules-core repo per https://github.com/ansible/ansible/blob/devel/ticket_stubs/module_repo.md but i'm letting it stay here until we know which module is at fault. I suspect easy_install believes pip is installed but doesn't know it hasn't been put into a location that is part of $PATH.

@jayenashar

This comment has been minimized.

Show comment
Hide comment
@jayenashar

jayenashar Jul 1, 2016

I had to use a different target host because I've already started using pip on the first one.

pip is not installed anywhere on the target host.

TASK [easy_install] ************************************************************
task path: /home/jayen/ansible-playbooks/hosts.yaml:7
<nucleosynthesis.buzzhives.com> ESTABLISH SSH CONNECTION FOR USER: None
<nucleosynthesis.buzzhives.com> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/jayen/.ansible/cp/ansible-ssh-%h-%p-%r nucleosynthesis.buzzhives.com '/bin/sh -c '"'"'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python && sleep 0'"'"''
ok: [nucleosynthesis.buzzhives.com] => {"binary": "/usr/bin/easy_install", "changed": false, "invocation": {"module_args": {"executable": "easy_install", "name": "pip", "state": "latest", "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_site_packages": false}, "module_name": "easy_install"}, "name": "pip", "virtualenv": null}

TASK [command] *****************************************************************
task path: /home/jayen/ansible-playbooks/hosts.yaml:9
<nucleosynthesis.buzzhives.com> ESTABLISH SSH CONNECTION FOR USER: None
<nucleosynthesis.buzzhives.com> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/jayen/.ansible/cp/ansible-ssh-%h-%p-%r nucleosynthesis.buzzhives.com '/bin/sh -c '"'"'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python && sleep 0'"'"''
fatal: [nucleosynthesis.buzzhives.com]: FAILED! => {"changed": true, "cmd": "which easy_install ; easy_install -m pip", "delta": "0:00:00.083565", "end": "2016-07-01 12:53:20.265306", "failed": true, "invocation": {"module_args": {"_raw_params": "which easy_install ; easy_install -m pip", "_uses_shell": true, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 1, "start": "2016-07-01 12:53:20.181741", "stderr": "error: can't create or remove files in install directory\n\nThe following error occurred while trying to add or remove files in the\ninstallation directory:\n\n    [Errno 13] Permission denied: '/usr/lib/python2.6/site-packages/test-easy-install-7989.write-test'\n\nThe installation directory you specified (via --install-dir, --prefix, or\nthe distutils default setting) was:\n\n    /usr/lib/python2.6/site-packages/\n\nPerhaps your account does not have write access to this directory?  If the\ninstallation directory is a system-owned directory, you may need to sign in\nas the administrator or \"root\" account.  If you do not have administrative\naccess to this machine, you may wish to choose a different installation\ndirectory, preferably one that is listed in your PYTHONPATH environment\nvariable.\n\nFor information on other options, you may wish to consult the\ndocumentation at:\n\n  http://peak.telecommunity.com/EasyInstall.html\n\nPlease make the appropriate changes for your system and try again.", "stdout": "/usr/bin/easy_install", "stdout_lines": ["/usr/bin/easy_install"], "warnings": []}

jayenashar commented Jul 1, 2016

I had to use a different target host because I've already started using pip on the first one.

pip is not installed anywhere on the target host.

TASK [easy_install] ************************************************************
task path: /home/jayen/ansible-playbooks/hosts.yaml:7
<nucleosynthesis.buzzhives.com> ESTABLISH SSH CONNECTION FOR USER: None
<nucleosynthesis.buzzhives.com> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/jayen/.ansible/cp/ansible-ssh-%h-%p-%r nucleosynthesis.buzzhives.com '/bin/sh -c '"'"'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python && sleep 0'"'"''
ok: [nucleosynthesis.buzzhives.com] => {"binary": "/usr/bin/easy_install", "changed": false, "invocation": {"module_args": {"executable": "easy_install", "name": "pip", "state": "latest", "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_site_packages": false}, "module_name": "easy_install"}, "name": "pip", "virtualenv": null}

TASK [command] *****************************************************************
task path: /home/jayen/ansible-playbooks/hosts.yaml:9
<nucleosynthesis.buzzhives.com> ESTABLISH SSH CONNECTION FOR USER: None
<nucleosynthesis.buzzhives.com> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/jayen/.ansible/cp/ansible-ssh-%h-%p-%r nucleosynthesis.buzzhives.com '/bin/sh -c '"'"'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python && sleep 0'"'"''
fatal: [nucleosynthesis.buzzhives.com]: FAILED! => {"changed": true, "cmd": "which easy_install ; easy_install -m pip", "delta": "0:00:00.083565", "end": "2016-07-01 12:53:20.265306", "failed": true, "invocation": {"module_args": {"_raw_params": "which easy_install ; easy_install -m pip", "_uses_shell": true, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 1, "start": "2016-07-01 12:53:20.181741", "stderr": "error: can't create or remove files in install directory\n\nThe following error occurred while trying to add or remove files in the\ninstallation directory:\n\n    [Errno 13] Permission denied: '/usr/lib/python2.6/site-packages/test-easy-install-7989.write-test'\n\nThe installation directory you specified (via --install-dir, --prefix, or\nthe distutils default setting) was:\n\n    /usr/lib/python2.6/site-packages/\n\nPerhaps your account does not have write access to this directory?  If the\ninstallation directory is a system-owned directory, you may need to sign in\nas the administrator or \"root\" account.  If you do not have administrative\naccess to this machine, you may wish to choose a different installation\ndirectory, preferably one that is listed in your PYTHONPATH environment\nvariable.\n\nFor information on other options, you may wish to consult the\ndocumentation at:\n\n  http://peak.telecommunity.com/EasyInstall.html\n\nPlease make the appropriate changes for your system and try again.", "stdout": "/usr/bin/easy_install", "stdout_lines": ["/usr/bin/easy_install"], "warnings": []}

@ansibot ansibot added affects_2.1 and removed needs_info labels Sep 7, 2016

@thegreatjerboa

This comment has been minimized.

Show comment
Hide comment
@thegreatjerboa

thegreatjerboa Oct 6, 2016

I ran into the same thing. And got the same output as @jayenashar. After seeing the permission error, I added become: true and it worked correctly.

thegreatjerboa commented Oct 6, 2016

I ran into the same thing. And got the same output as @jayenashar. After seeing the permission error, I added become: true and it worked correctly.

@Lujeni

This comment has been minimized.

Show comment
Hide comment
@Lujeni

Lujeni Dec 28, 2016

Contributor

Hello @jayenashar @jctanner @thegreatjerboa

The plugin never test the result command of the is_package_installed function.
This PR #19705 should be enought to fix the problem.

Feel free to test on your side.

Contributor

Lujeni commented Dec 28, 2016

Hello @jayenashar @jctanner @thegreatjerboa

The plugin never test the result command of the is_package_installed function.
This PR #19705 should be enought to fix the problem.

Feel free to test on your side.

@abadger

This comment has been minimized.

Show comment
Hide comment
@abadger

abadger Jan 5, 2017

Member

PR #19705 has been merged and cherry picked to stable-2.2 which should fix this problem. Closing ticket.

Member

abadger commented Jan 5, 2017

PR #19705 has been merged and cherry picked to stable-2.2 which should fix this problem. Closing ticket.

@abadger abadger closed this Jan 5, 2017

@ansibot ansibot added bug and removed bug_report labels Mar 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment