-
Notifications
You must be signed in to change notification settings - Fork 110
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_container_exec: improve handling of chdir option #243
docker_container_exec: improve handling of chdir option #243
Conversation
The same problem also happens for the |
…being used for Docker SDK for Python < 3.0.0.
1430b7d
to
f7bb702
Compare
Would be glad if anyone could review this :) |
option_minimal_versions = dict( | ||
chdir=dict(docker_py_version='3.0.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.
holy ravioli, I hadn't seen this construct before, is it new? awesome :-)
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.
No, it's actually pretty old ;-) I originally created it for docker_container, since it has sooo many options and these have so many different requirements...
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.
Cool, will take a look at it!
@@ -164,7 +164,7 @@ def exec_command(self, cmd, in_data=None, sudoable=False): | |||
stderr=True, | |||
stdin=need_stdin, | |||
user=self._play_context.remote_user or '', | |||
workdir=None, | |||
# workdir=None, - only works for Docker SDK for Python 3.0.0 and later |
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.
shouldn't it be deprecated instead?
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.
No, right now this isn't used at all (None
is the default value anyway, which means "use whatever working dir the container is using anyway"). Having this always present only breaks usage wiht Docker SDK for Python < 3.0.0, but doesn't have any effect on >= 3.0.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.
LGTM
option_minimal_versions = dict( | ||
chdir=dict(docker_py_version='3.0.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.
Cool, will take a look at it!
Backport to stable-1: 💚 backport PR created✅ Backport PR branch: Backported as #247 🤖 @patchback |
* Only pass chdir on when it is provided, and prevent this option from being used for Docker SDK for Python < 3.0.0. * Also fix docker_api connection plugin. (cherry picked from commit bed775c)
@russoz thanks a lot for reviewing this! |
* Only pass chdir on when it is provided, and prevent this option from being used for Docker SDK for Python < 3.0.0. * Also fix docker_api connection plugin. (cherry picked from commit bed775c) Co-authored-by: Felix Fontein <felix@fontein.de>
SUMMARY
Only pass chdir on when it is provided, and prevent this option from being used for Docker SDK for Python < 3.0.0
The
workdir
option was added toexec_create
in 3.0.0: docker/docker-py@abd60aeFixes #242.
ISSUE TYPE
COMPONENT NAME
docker_container_exec