From 263a234374db26210c38961cbf815d91936cfffe Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 23 Nov 2024 00:19:33 +0100 Subject: [PATCH] module docker_compose_v2_run: fix env argument (#992) (#994) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * module docker_compose_v2_run: fix env argument * fix missing "--env" in docker_compose_v2_exec, and added changelog fragment * Update changelogs/fragments/992-module-docker_compose_v2_run-fix-env-argument.yml Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein (cherry picked from commit e3b36e5f0a12d8fe86a659f06fa035a1628b16ea) Co-authored-by: Sánta Balázs Levente <99618028+SantaBalazsLevente@users.noreply.github.com> --- .../992-module-docker_compose_v2_run-fix-env-argument.yml | 2 ++ plugins/modules/docker_compose_v2_exec.py | 1 + plugins/modules/docker_compose_v2_run.py | 1 + 3 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/992-module-docker_compose_v2_run-fix-env-argument.yml diff --git a/changelogs/fragments/992-module-docker_compose_v2_run-fix-env-argument.yml b/changelogs/fragments/992-module-docker_compose_v2_run-fix-env-argument.yml new file mode 100644 index 000000000..c02d39607 --- /dev/null +++ b/changelogs/fragments/992-module-docker_compose_v2_run-fix-env-argument.yml @@ -0,0 +1,2 @@ +bugfixes: +- "docker_compose_v2_exec, docker_compose_v2_run - fix missing ``--env`` flag while assembling env arguments (https://github.com/ansible-collections/community.docker/pull/992)." \ No newline at end of file diff --git a/plugins/modules/docker_compose_v2_exec.py b/plugins/modules/docker_compose_v2_exec.py index 5590f77e1..bd3391d16 100644 --- a/plugins/modules/docker_compose_v2_exec.py +++ b/plugins/modules/docker_compose_v2_exec.py @@ -229,6 +229,7 @@ def get_exec_cmd(self, dry_run, no_start=False): args.append('--no-TTY') if self.env: for name, value in list(self.env.items()): + args.append('--env') args.append('{0}={1}'.format(name, value)) args.append('--') args.append(self.service) diff --git a/plugins/modules/docker_compose_v2_run.py b/plugins/modules/docker_compose_v2_run.py index c27a85c8b..6c8df8ed3 100644 --- a/plugins/modules/docker_compose_v2_run.py +++ b/plugins/modules/docker_compose_v2_run.py @@ -346,6 +346,7 @@ def get_run_cmd(self, dry_run, no_start=False): args.append('--no-TTY') if self.env: for name, value in list(self.env.items()): + args.append('--env') args.append('{0}={1}'.format(name, value)) args.append('--') args.append(self.service)