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

Update vendored Docker SDK for Python code #694

Merged
merged 4 commits into from
Oct 8, 2023

Conversation

felixfontein
Copy link
Collaborator

SUMMARY

Vendor all relevant commits from docker/docker-py@bc4c0d7...c38656d.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

vendored Docker SDK for Python code

felixfontein and others added 4 commits October 7, 2023 14:09
…ropagation

https://docs.docker.com/storage/bind-mounts/#configure-bind-propagation

Cherry-picked from docker/docker-py@bea6322

Co-authored-by: Janne Jakob Fleischer <janne.fleischer@ils-forschung.de>
Co-authored-by: Milas Bowman <milas.bowman@docker.com>
Check if poll attribute exists on select module instead of win32 platform check

The implementation done in #2865 is breaking usage of docker-py library within eventlet.
As per the Python `select.poll` documentation (https://docs.python.org/3/library/select.html#select.poll) and eventlet select removal advice (eventlet/eventlet#608 (comment)), it is preferable to use an implementation based on the availability of the `poll()` method that trying to check if the platform is `win32`.

Fixes docker/docker-py#3131

Cherry-picked from docker/docker-py@78439eb

Co-authored-by: Mathieu Virbel <mat@meltingrocks.com>
…ring rather than bytes

Adjusted from docker/docker-py@0618951

Co-authored-by: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com>
Co-authored-by: Milas Bowman <milas.bowman@docker.com>
@@ -43,7 +42,7 @@ def read(socket, n=4096):
recoverable_errors = (errno.EINTR, errno.EDEADLK, errno.EWOULDBLOCK)

if PY3 and not isinstance(socket, NpipeSocket):
if sys.platform == 'win32':
if not hasattr(select, "poll"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand the specifics of what's going on here, but the conditional is quite different. Was the issue actually that select.poll was not defined on Windows platforms? If the attribute exists on Windows but did not work (or didn't work correctly for this situation) then this test would cause failures.

I guess, this code being vendored, it never will run on Windows (unless I ever get around to trying to get Ansible Python modules to execute on Windows but alas....).

Still, what was the motivation for this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been cherry-picked from docker/docker-py@78439eb to support eventlet. Our code neither supports Windows (outside WSL2) nor does it support eventlet, I'd still like the socket code to be as close as possible to Docker SDK for Python's code even for features we have no need for.

@felixfontein felixfontein merged commit 4d9b85c into ansible-collections:main Oct 8, 2023
96 checks passed
@felixfontein felixfontein deleted the docker-py-2 branch October 8, 2023 16:16
@felixfontein
Copy link
Collaborator Author

@briantist thanks a lot for reviewing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants