From e29af6bb7754bb549c2c40504428b5d39bed1c2c Mon Sep 17 00:00:00 2001 From: Sagi Shnaidman Date: Thu, 30 Nov 2023 13:47:03 +0200 Subject: [PATCH] Fix idempotency when using 0.0.0.0 in ports Fix #678 Signed-off-by: Sagi Shnaidman --- plugins/module_utils/podman/podman_container_lib.py | 2 +- .../targets/podman_container_idempotency/tasks/idem_ports.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/module_utils/podman/podman_container_lib.py b/plugins/module_utils/podman/podman_container_lib.py index e317e2f1..33530fd3 100644 --- a/plugins/module_utils/podman/podman_container_lib.py +++ b/plugins/module_utils/podman/podman_container_lib.py @@ -1187,7 +1187,7 @@ def compose(p, h): if image_ports: after += list(image_ports.keys()) after = [ - i.replace("/tcp", "").replace("[", "").replace("]", "") + i.replace("/tcp", "").replace("[", "").replace("]", "").replace("0.0.0.0:", "") for i in after] # No support for port ranges yet for ports in after: diff --git a/tests/integration/targets/podman_container_idempotency/tasks/idem_ports.yml b/tests/integration/targets/podman_container_idempotency/tasks/idem_ports.yml index 54a667c8..81b7baf0 100644 --- a/tests/integration/targets/podman_container_idempotency/tasks/idem_ports.yml +++ b/tests/integration/targets/podman_container_idempotency/tasks/idem_ports.yml @@ -40,6 +40,7 @@ - "127.0.0.1:43423:8872" - "127.0.0.2:43423:8872/tcp" - "127.0.0.3:43423:8872" + - "0.0.0.0:15674:7846" register: test2 - name: check test2 @@ -63,6 +64,7 @@ - "127.0.0.1:43423:8872" - "127.0.0.2:43423:8872/tcp" - "127.0.0.3:43423:8872" + - "0.0.0.0:15674:7846" register: test3 - name: check test3