1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

podman_container_lib: Added checks for volume opts (#941)

* podman_container_lib: Added checks for volume opts

Changed the diffparam_volume function to include the volume mount opts.

Signed-off-by: Lucas Benedito <lbenedit@redhat.com>

* Add test for volume mount options

Signed-off-by: Lucas Benedito <lbenedit@redhat.com>

---------

Signed-off-by: Lucas Benedito <lbenedit@redhat.com>
This commit is contained in:
lucas-benedito 2025-06-22 10:17:32 +01:00 committed by GitHub
parent 4c682e170c
commit 6ff93e7559
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 2 deletions

View file

@ -1560,12 +1560,12 @@ class PodmanContainerDiff:
after = self.params["volume"]
if after is not None:
after = [
":".join([clean_volume(i) for i in v.split(":")[:2]])
":".join([clean_volume(i) for i in v.split(":")[:3]])
for v in self.params["volume"]
]
if before is not None:
before = [
":".join([clean_volume(i) for i in v.split(":")[:2]]) for v in before
":".join([clean_volume(i) for i in v.split(":")[:3]]) for v in before
]
if before is None and after is None:
return self._diff_update_and_compare("volume", before, after)

View file

@ -349,3 +349,36 @@
- name: check test23
assert:
that: test23 is not changed
- ansible.builtin.file:
path: /tmp/data
state: directory
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
name: test24
image: alpine
state: present
volumes:
- /tmp/data:/data:z
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
name: test24
image: alpine
state: present
volumes:
- /tmp/data:/data:U
register: test24
- name: Check test24
assert:
that:
- test24 is changed
- >-
(test24.container['Config']['CreateCommand'] is defined and
'/tmp/data:/data:U' in test24.container['Config']['CreateCommand'] | list)
- ansible.builtin.file:
path: /tmp/data
state: absent