Jilles van Gurp
2015-02-17 18:23:10 UTC
I just ran into an obscure issue where I actually had a version of
docker-py installed on a target system but not the latest version. Long
version below but the tldr; is that I eventually solved it with a manual
pip install --upgrade.
I was looking at the pip module documentation and there's nothing about
--upgrade there. I guess I could pass it in via extra_args="--upgrade" but
this sounds like it deserves a bit more prominent mention. Also it sounds
like it might actually be a useful default even if the user specifies no
version (latest is implied) and the installed version is outdated. Either
that or it should fail because it can't get the latest version installed
unless you specify --upgrade.
Long version:
So, I was getting the error that
Traceback (most recent call last):
File
"/home/linko/.ansible/tmp/ansible-tmp-1424196296.48-135783178760818/docker",
line 2422, in <module>
main()
File
"/home/linko/.ansible/tmp/ansible-tmp-1424196296.48-135783178760818/docker",
line 729, in main
docker_api_version =
dict(default=docker.client.DEFAULT_DOCKER_API_VERSION),
NameError: global name 'docker' is not defined
When trying to run my ansible playbook that first installs docker and then
boots up a docker image. Basically it looked like I didn't have docker-py
installed; except I had.
Actually I was installing it via a docker role:
---
- name: Install Python Pip
yum: name=python-pip state=latest
- name: ensure docker is installed
yum: name=docker state=latest
- name: Install Docker-py
pip: name=docker-py
- name: Start docker daemon
service: name=docker state=started enabled=yes sleep=1
The problem as it turned out to be, was that pip was basically 'succeeding'
with the following message:
ok: [testing.inbot.io] => {"changed": false, "cmd": "/bin/pip install
docker-py", "name": "docker-py", "requirements": null, "state": "present",
"stderr": "", "stdout": "Requirement already satisfied (use --upgrade to
upgrade): docker-py in /usr/lib/python2.7/site-packages\nRequirement
already satisfied (use --upgrade to upgrade): requests>=2.2.1,<2.5.0 in
/usr/lib/python2.7/site-packages (from docker-py)\nRequirement already
satisfied (use --upgrade to upgrade): six>=1.3.0 in
/usr/lib/python2.7/site-packages (from docker-py)\nRequirement already
satisfied (use --upgrade to upgrade): websocket-client>=0.11.0 in
/usr/lib/python2.7/site-packages (from docker-py)\nRequirement already
satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in
/usr/lib/python2.7/site-packages (from
websocket-client>=0.11.0->docker-py)\nCleaning up...\n", "version": null,
"virtualenv": null}
Solution:
sudo pip install docker-py --upgrade
After that everything works as it is supposed to.
docker-py installed on a target system but not the latest version. Long
version below but the tldr; is that I eventually solved it with a manual
pip install --upgrade.
I was looking at the pip module documentation and there's nothing about
--upgrade there. I guess I could pass it in via extra_args="--upgrade" but
this sounds like it deserves a bit more prominent mention. Also it sounds
like it might actually be a useful default even if the user specifies no
version (latest is implied) and the installed version is outdated. Either
that or it should fail because it can't get the latest version installed
unless you specify --upgrade.
Long version:
So, I was getting the error that
Traceback (most recent call last):
File
"/home/linko/.ansible/tmp/ansible-tmp-1424196296.48-135783178760818/docker",
line 2422, in <module>
main()
File
"/home/linko/.ansible/tmp/ansible-tmp-1424196296.48-135783178760818/docker",
line 729, in main
docker_api_version =
dict(default=docker.client.DEFAULT_DOCKER_API_VERSION),
NameError: global name 'docker' is not defined
When trying to run my ansible playbook that first installs docker and then
boots up a docker image. Basically it looked like I didn't have docker-py
installed; except I had.
Actually I was installing it via a docker role:
---
- name: Install Python Pip
yum: name=python-pip state=latest
- name: ensure docker is installed
yum: name=docker state=latest
- name: Install Docker-py
pip: name=docker-py
- name: Start docker daemon
service: name=docker state=started enabled=yes sleep=1
The problem as it turned out to be, was that pip was basically 'succeeding'
with the following message:
ok: [testing.inbot.io] => {"changed": false, "cmd": "/bin/pip install
docker-py", "name": "docker-py", "requirements": null, "state": "present",
"stderr": "", "stdout": "Requirement already satisfied (use --upgrade to
upgrade): docker-py in /usr/lib/python2.7/site-packages\nRequirement
already satisfied (use --upgrade to upgrade): requests>=2.2.1,<2.5.0 in
/usr/lib/python2.7/site-packages (from docker-py)\nRequirement already
satisfied (use --upgrade to upgrade): six>=1.3.0 in
/usr/lib/python2.7/site-packages (from docker-py)\nRequirement already
satisfied (use --upgrade to upgrade): websocket-client>=0.11.0 in
/usr/lib/python2.7/site-packages (from docker-py)\nRequirement already
satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in
/usr/lib/python2.7/site-packages (from
websocket-client>=0.11.0->docker-py)\nCleaning up...\n", "version": null,
"virtualenv": null}
Solution:
sudo pip install docker-py --upgrade
After that everything works as it is supposed to.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fd9826b2-2520-433a-a48a-f5f39ef8af9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fd9826b2-2520-433a-a48a-f5f39ef8af9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.