-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Docker modules: improve documentation on docker vs. docker-py Python package requirements #42457
Docker modules: improve documentation on docker vs. docker-py Python package requirements #42457
Conversation
@@ -36,6 +36,12 @@ | |||
requirements: | |||
- "python >= 2.6" | |||
- "docker-py >= 1.7.0" | |||
- "Please note that the L(docker-py,https://pypi.org/project/docker-py/) Python | |||
module has been superseeded by L(docker,https://pypi.org/project/docker/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: superseeded -> superseded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing! I just fixed all of them.
@@ -77,6 +77,12 @@ | |||
requirements: | |||
- "python >= 2.6" | |||
- "docker-py >= 1.7.0" | |||
- "Please note that the L(docker-py,https://pypi.org/project/docker-py/) Python | |||
module has been superseeded by L(docker,https://pypi.org/project/docker/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
@@ -96,6 +96,12 @@ | |||
requirements: | |||
- "python >= 2.6" | |||
- "docker-py >= 1.7.0" | |||
- "Please note that the L(docker-py,https://pypi.org/project/docker-py/) Python | |||
module has been superseeded by L(docker,https://pypi.org/project/docker/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
@@ -60,6 +60,10 @@ | |||
|
|||
requirements: | |||
- "docker-py >= 2.1.0" | |||
- "Please note that the L(docker-py,https://pypi.org/project/docker-py/) Python | |||
module has been superseeded by L(docker,https://pypi.org/project/docker/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise.
@@ -143,6 +143,13 @@ | |||
|
|||
requirements: | |||
- "python >= 2.6" | |||
- "docker-py >= 1.8.0" | |||
- "Please note that the L(docker-py,https://pypi.org/project/docker-py/) Python | |||
module has been superseeded by L(docker,https://pypi.org/project/docker/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here as well.
@@ -136,6 +136,13 @@ | |||
- docker | |||
requirements: | |||
- python >= 2.7 | |||
- docker-py >= 1.7.0 | |||
- "Please note that the L(docker-py,https://pypi.org/project/docker-py/) Python | |||
module has been superseeded by L(docker,https://pypi.org/project/docker/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here.
@@ -68,6 +68,12 @@ | |||
requirements: | |||
- "python >= 2.6" | |||
- "docker-py >= 1.10.0" | |||
- "Please note that the L(docker-py,https://pypi.org/project/docker-py/) Python | |||
module has been superseeded by L(docker,https://pypi.org/project/docker/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And finally here too.
@@ -136,6 +136,13 @@ | |||
- docker | |||
requirements: | |||
- python >= 2.7 | |||
- docker-py >= 1.7.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think docker_swarm
is for docker's built-in swarm mode, docker-py
should have a higher version number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per http://docker-py.readthedocs.io/en/stable/change-log.html, it should be >= 1.10.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, good question; the code also uses the log_driver
parameter of create_swarm_spec
, which has (according to the change log) only introduced in 2.6.0; I'll bump it up to that for now. @tbouvet: do you know more details?
@@ -68,6 +68,12 @@ | |||
requirements: | |||
- "python >= 2.6" | |||
- "docker-py >= 1.10.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per change log, this should be 1.5.0
, but align this with MIN_DOCKER_VERSION = 1.7.0
, it should not be listed explictly here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this is document, keep this and align to 1.7.0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It uses the labels
parameter for the create_volume
call, so according to https://docker-py.readthedocs.io/en/stable/change-log.html it requires 1.10.0.
@@ -143,6 +143,13 @@ | |||
|
|||
requirements: | |||
- "python >= 2.6" | |||
- "docker-py >= 1.8.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does docker_service
needs an explicitly dependency on docker-py
version, or just implicitly inherits docker-compose
's requirement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should implicitly inherit docker-compose
's requirements. My idea was to list it nonetheless (so it's listed for all docker_*
modules), but I can remove it if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, leaving a deprecation comment about docker-py
and docker
everywhere is boring, but useful for newbies.
@@ -96,7 +96,7 @@ | |||
description: | |||
- Path to a file containing environment variables I(FOO=BAR). | |||
- If variable also present in C(env), then C(env) value will override. | |||
- Requires docker >= 2.3.0. | |||
- Requires docker-py >= 1.4.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align with MIN_DOCKER_VERSION
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it, since the general requirements for the module already specify docker-py >= 1.7.0
.
There're too many commits, could you please rebase them? It will make the commit history cleaner after getting merged. |
744ed7d
to
ceb2d6f
Compare
I've squashed them. This would have happen during merge anyway, but this way the commit message is nicer ;-) |
@felixfontein Does this resolves - #38833 ? |
@Akasurde I don't think so. This PR is (so far) only about the dependency on the |
shipit |
…bout docker vs. docker-py.
ceb2d6f
to
d316a76
Compare
Now that #40839 has been merged, I rebased against |
Everyone, thanks for your reviews, and thanks for handling this! :) |
I will create a backport PR for |
…package requirements (ansible#42457) * Make sure all docker-py/docker requirements are listed, and clarify about docker vs. docker-py. * Adjusting changes made in ansible#40839.
SUMMARY
The original (semi-)official Python module for working with docker was called docker-py, which exists up to version 1.10.6. It has been renamed/superseeded to/by the docker module, which starts with version 2.0.0.
This (and the fact that this is not mentioned on either of the pypi pages; though such a note was apparently added, but later got lost again) leads to a lot of confusion, which can be seen for example in #42162 and #42258. A lot of people seem to believe since the requirements and error messages only mention
python-py
, that the modules do not work with the Pythondocker
module (which is wrong, except if this is caused by a bug -- but that should not be fixed by adjusting the requirements). On the other hand,python-py
is still required for Python 2.6, since Python 2.6 support was dropped before the first release ofdocker
.This PR tries to clean up the documentation by adding a disclaimer in the requirements section of every module mentioning both
docker
anddocker-py
(recommendingdocker
if Python 2.6 is not required), and updates the error messages in the common code inmodule_utils/docker_common.py
to also mentiondocker
and not justdocker-py
.Superseeds #42370 and #42394. Fixes #42258.
CC @samdoran, @kassiansun.
I would appreciate it if some of the docker module maintainers could take a look at this in more detail. Thanks.
ISSUE TYPE
COMPONENT NAME
lib/ansible/module_utils/docker_common.py
docker_container
docker_image
docker_image_facts
docker_login
docker_network
docker_secret
docker_service
docker_swarm
docker_volume
ANSIBLE VERSION