From 6fcbd34e23c1f961f1ecf6d8756e9b22c3cd557c Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 7 Jul 2024 23:18:58 +0200 Subject: [PATCH] Prevent infinite loop. (#922) --- changelogs/fragments/922-docker_container-wait-fix.yml | 2 ++ plugins/module_utils/module_container/module.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/922-docker_container-wait-fix.yml diff --git a/changelogs/fragments/922-docker_container-wait-fix.yml b/changelogs/fragments/922-docker_container-wait-fix.yml new file mode 100644 index 00000000..5cbaac33 --- /dev/null +++ b/changelogs/fragments/922-docker_container-wait-fix.yml @@ -0,0 +1,2 @@ +bugfixes: + - "docker_container - fix possible infinite loop if ``removal_wait_timeout`` is set (https://github.com/ansible-collections/community.docker/pull/922)." diff --git a/plugins/module_utils/module_container/module.py b/plugins/module_utils/module_container/module.py index 5d819efa..bff2ec19 100644 --- a/plugins/module_utils/module_container/module.py +++ b/plugins/module_utils/module_container/module.py @@ -247,7 +247,7 @@ class ContainerManager(DockerBaseClass): self.fail(msg.format(container_id, state)) # Wait if max_wait is not None: - if total_wait > max_wait: + if total_wait > max_wait or delay < 1E-4: msg = 'Timeout of {1} seconds exceeded while waiting for container "{0}"' self.fail(msg.format(container_id, max_wait)) if total_wait + delay > max_wait: