From 338b3db654ea4472e40a3b3ab859efbe3a9f0d2b Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 22:15:18 +0200 Subject: [PATCH] Fix crashes due to wrong names. (#1161) (#1163) (#1164) (cherry picked from commit 33c8a491915f8ee04af0de36314e7b149dafb012) (cherry picked from commit b058cd40da1c9bb3440dcb257b2045fd2bf450c1) Co-authored-by: Felix Fontein --- changelogs/fragments/1161-fix.yml | 4 ++++ plugins/connection/docker.py | 2 +- plugins/modules/docker_compose_v2_exec.py | 2 +- plugins/modules/docker_compose_v2_run.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/1161-fix.yml diff --git a/changelogs/fragments/1161-fix.yml b/changelogs/fragments/1161-fix.yml new file mode 100644 index 00000000..a7446de4 --- /dev/null +++ b/changelogs/fragments/1161-fix.yml @@ -0,0 +1,4 @@ +bugfixes: + - "docker connection plugin - fix crash instead of warning if Docker version does not support ``remote_user`` (https://github.com/ansible-collections/community.docker/pull/1161)." + - "docker_compose_v2_exec - fix crash instead of reporting error if ``detach=true`` and ``stdin`` is provided (https://github.com/ansible-collections/community.docker/pull/1161)." + - "docker_compose_v2_run - fix crash instead of reporting error if ``detach=true`` and ``stdin`` is provided (https://github.com/ansible-collections/community.docker/pull/1161)." diff --git a/plugins/connection/docker.py b/plugins/connection/docker.py index 5ff2f0b4..53ebac0b 100644 --- a/plugins/connection/docker.py +++ b/plugins/connection/docker.py @@ -330,7 +330,7 @@ class Connection(ConnectionBase): actual_user = self._get_docker_remote_user() if actual_user != self.get_option('remote_user'): display.warning(u'docker {0} does not support remote_user, using container default: {1}' - .format(self.docker_version, self.actual_user or u'?')) + .format(self.docker_version, actual_user or u'?')) return actual_user elif self._display.verbosity > 2: # Since we are not setting the actual_user, look it up so we have it for logging later diff --git a/plugins/modules/docker_compose_v2_exec.py b/plugins/modules/docker_compose_v2_exec.py index bd3391d1..c36d6b9f 100644 --- a/plugins/modules/docker_compose_v2_exec.py +++ b/plugins/modules/docker_compose_v2_exec.py @@ -199,7 +199,7 @@ class ExecManager(BaseComposeManager): self.argv = shlex.split(parameters['command']) if self.detach and self.stdin is not None: - self.mail('If detach=true, stdin cannot be provided.') + self.fail('If detach=true, stdin cannot be provided.') if self.stdin is not None and parameters['stdin_add_newline']: self.stdin += '\n' diff --git a/plugins/modules/docker_compose_v2_run.py b/plugins/modules/docker_compose_v2_run.py index 886c7601..3893dd8a 100644 --- a/plugins/modules/docker_compose_v2_run.py +++ b/plugins/modules/docker_compose_v2_run.py @@ -283,7 +283,7 @@ class ExecManager(BaseComposeManager): self.argv = shlex.split(parameters['command']) if self.detach and self.stdin is not None: - self.mail('If detach=true, stdin cannot be provided.') + self.fail('If detach=true, stdin cannot be provided.') if self.stdin is not None and parameters['stdin_add_newline']: self.stdin += '\n'