From 23fde625f661b72f5282d7ebe6dd926fff84a9be Mon Sep 17 00:00:00 2001 From: Sergey Date: Thu, 17 Feb 2022 18:29:51 +0200 Subject: [PATCH] Strip slashes from volumes (#379) Fix #372 Signed-off-by: Sagi Shnaidman --- plugins/module_utils/podman/podman_container_lib.py | 9 +++++++-- .../podman_container_idempotency/tasks/idem_volumes.yml | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/module_utils/podman/podman_container_lib.py b/plugins/module_utils/podman/podman_container_lib.py index 32ae993..9b72bfc 100644 --- a/plugins/module_utils/podman/podman_container_lib.py +++ b/plugins/module_utils/podman/podman_container_lib.py @@ -1225,9 +1225,14 @@ class PodmanContainerDiff: local_vols = [] for m in before: if m['type'] != 'volume': - volumes.append([m['source'], m['destination']]) + volumes.append( + [ + clean_volume(m['source']), + clean_volume(m['destination']) + ]) elif m['type'] == 'volume': - local_vols.append([m['name'], m['destination']]) + local_vols.append( + [m['name'], clean_volume(m['destination'])]) before = [":".join(v) for v in volumes] before_local_vols = [":".join(v) for v in local_vols] if self.params['volume'] is not None: diff --git a/tests/integration/targets/podman_container_idempotency/tasks/idem_volumes.yml b/tests/integration/targets/podman_container_idempotency/tasks/idem_volumes.yml index 5924a35..4121e4c 100644 --- a/tests/integration/targets/podman_container_idempotency/tasks/idem_volumes.yml +++ b/tests/integration/targets/podman_container_idempotency/tasks/idem_volumes.yml @@ -47,7 +47,7 @@ name: idempotency state: present volumes: - - /opt:/somedir + - /opt:/somedir/ command: 1h register: test4 @@ -60,7 +60,7 @@ name: idempotency state: present volumes: - - /opt/://somedir + - /opt/://somedir/ command: 1h register: test5