module docker_compose_v2_run: fix env argument (#992) (#994)

* 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 <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit e3b36e5f0a)

Co-authored-by: Sánta Balázs Levente <99618028+SantaBalazsLevente@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2024-11-23 00:19:33 +01:00 committed by GitHub
parent 9987b73712
commit 263a234374
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 0 deletions

View File

@ -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)."

View File

@ -229,6 +229,7 @@ class ExecManager(BaseComposeManager):
args.append('--no-TTY') args.append('--no-TTY')
if self.env: if self.env:
for name, value in list(self.env.items()): for name, value in list(self.env.items()):
args.append('--env')
args.append('{0}={1}'.format(name, value)) args.append('{0}={1}'.format(name, value))
args.append('--') args.append('--')
args.append(self.service) args.append(self.service)

View File

@ -346,6 +346,7 @@ class ExecManager(BaseComposeManager):
args.append('--no-TTY') args.append('--no-TTY')
if self.env: if self.env:
for name, value in list(self.env.items()): for name, value in list(self.env.items()):
args.append('--env')
args.append('{0}={1}'.format(name, value)) args.append('{0}={1}'.format(name, value))
args.append('--') args.append('--')
args.append(self.service) args.append(self.service)