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

chdir on docker_compose_exec missing pass-through #517

Closed
smoberly opened this issue Dec 1, 2022 · 2 comments · Fixed by #518
Closed

chdir on docker_compose_exec missing pass-through #517

smoberly opened this issue Dec 1, 2022 · 2 comments · Fixed by #518
Labels
bug Something isn't working docker-plain plain Docker (no swarm, no compose, no stack)

Comments

@smoberly
Copy link

smoberly commented Dec 1, 2022

The chdir parameter seems to have been missed during the rewrite. The following line needs to be added:

--- a/plugins/modules/docker_container_exec.py
+++ b/plugins/modules/docker_container_exec.py
@@ -249,6 +249,7 @@ def main():
             'AttachStderr': True,
             'Cmd': argv,
             'Env': format_environment(env) if env is not None else None,
+            'WorkingDir', chdir or '',
         }
         exec_data = client.post_json_to_json('/containers/{0}/exec', container, data=data)
         exec_id = exec_data['Id']
@felixfontein felixfontein added bug Something isn't working docker-plain plain Docker (no swarm, no compose, no stack) labels Dec 1, 2022
@felixfontein
Copy link
Collaborator

Thanks for reporting this! I've created a fix in #518. The fix needs to be a bit more complicated though since the module also supports API < 1.35, which does not accept the WorkingDir argument. (I'm not sure whether the API would actually complain if it is still specified, but better safe than sorry... :) )

@smoberly
Copy link
Author

smoberly commented Dec 2, 2022

Yeah, the previous code base had that exception in there too. So, I just pointed to the problem. Thanks for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker-plain plain Docker (no swarm, no compose, no stack)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants