mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
Set custom tmpfs idempotency (#932)
Fix #918 Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
5ea945dffe
commit
2c040aa346
2 changed files with 80 additions and 1 deletions
|
|
@ -1436,7 +1436,20 @@ class PodmanContainerDiff:
|
|||
return self._diff_update_and_compare('tty', before, after)
|
||||
|
||||
def diffparam_tmpfs(self):
|
||||
return self._diff_generic('tmpfs', '--tmpfs')
|
||||
before = createcommand("--tmpfs", self.info["config"])
|
||||
if before == []:
|
||||
before = None
|
||||
after = self.params['tmpfs']
|
||||
if before is None and after is None:
|
||||
return self._diff_update_and_compare('tmpfs', before, after)
|
||||
if after is not None:
|
||||
after = ",".join(sorted(
|
||||
[str(k).lower() + ":" + str(v).lower() for k, v in after.items() if v is not None]))
|
||||
if before:
|
||||
before = ",".join(sorted([j.lower() for j in before]))
|
||||
else:
|
||||
before = ''
|
||||
return self._diff_update_and_compare('tmpfs', before, after)
|
||||
|
||||
def diffparam_uidmap(self):
|
||||
return self._diff_generic('uidmap', '--uidmap')
|
||||
|
|
|
|||
|
|
@ -483,6 +483,72 @@
|
|||
assert:
|
||||
that: test32 is changed
|
||||
|
||||
- name: Run container without tmpfs mount
|
||||
containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: "{{ idem_image }}"
|
||||
name: idempotency
|
||||
state: present
|
||||
register: test33
|
||||
|
||||
- name: Run container with tmpfs mount
|
||||
containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: "{{ idem_image }}"
|
||||
name: idempotency
|
||||
state: present
|
||||
tmpfs:
|
||||
"/var/cache": "rw,size=512M"
|
||||
register: test34
|
||||
|
||||
- name: Check container with tmpfs mount
|
||||
assert:
|
||||
that:
|
||||
- test34 is changed
|
||||
|
||||
- name: Run container with tmpfs mount again
|
||||
containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: "{{ idem_image }}"
|
||||
name: idempotency
|
||||
state: present
|
||||
tmpfs:
|
||||
"/var/cache": "rw,size=512M"
|
||||
register: test35
|
||||
|
||||
- name: Check container with tmpfs mount again
|
||||
assert:
|
||||
that:
|
||||
- test35 is not changed
|
||||
|
||||
- name: Run container with different tmpfs mount
|
||||
containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: "{{ idem_image }}"
|
||||
name: idempotency
|
||||
state: present
|
||||
tmpfs:
|
||||
"/var/cache": "rw,size=256M"
|
||||
register: test36
|
||||
|
||||
- name: Check container with different tmpfs mount
|
||||
assert:
|
||||
that:
|
||||
- test36 is changed
|
||||
|
||||
- name: Run container without tmpfs mount
|
||||
containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: "{{ idem_image }}"
|
||||
name: idempotency
|
||||
state: present
|
||||
register: test37
|
||||
|
||||
- name: Check container without tmpfs mount
|
||||
assert:
|
||||
that:
|
||||
- test37 is changed
|
||||
|
||||
- name: Remove dependent test container
|
||||
containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue