Fix chdir option. (#518)

This commit is contained in:
Felix Fontein 2022-12-02 06:48:39 +01:00 committed by GitHub
parent 549de87ab5
commit 6ccbde9f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- "docker_container_exec - fix ``chdir`` option which was ignored since community.docker 3.0.0 (https://github.com/ansible-collections/community.docker/issues/517, https://github.com/ansible-collections/community.docker/pull/518)."

View File

@ -250,6 +250,9 @@ def main():
'Cmd': argv, 'Cmd': argv,
'Env': format_environment(env) if env is not None else None, 'Env': format_environment(env) if env is not None else None,
} }
if chdir is not None:
data['WorkingDir'] = chdir
exec_data = client.post_json_to_json('/containers/{0}/exec', container, data=data) exec_data = client.post_json_to_json('/containers/{0}/exec', container, data=data)
exec_id = exec_data['Id'] exec_id = exec_data['Id']