mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
podman-pod: Fix idempotency for pods in 4.4.x versions (#593)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
e5b37d9756
commit
45e1de2bfe
2 changed files with 20 additions and 2 deletions
|
|
@ -443,6 +443,15 @@ class PodmanPodDiff:
|
|||
net_mode_before = net_mode_before.replace('bridge', 'default')
|
||||
net_mode_before = net_mode_before.replace('slirp4netns', 'default')
|
||||
return self._diff_update_and_compare('network', net_mode_before, net_mode_after)
|
||||
# For 4.4.0+ podman versions with no network specified
|
||||
if not net_mode_after and net_mode_before == 'slirp4netns' and not after:
|
||||
net_mode_after = 'slirp4netns'
|
||||
if before == ['slirp4netns']:
|
||||
after = ['slirp4netns']
|
||||
if not net_mode_after and net_mode_before == 'bridge' and not after:
|
||||
net_mode_after = 'bridge'
|
||||
if before == ['bridge']:
|
||||
after = ['bridge']
|
||||
before, after = sorted(list(set(before))), sorted(list(set(after)))
|
||||
return self._diff_update_and_compare('network', before, after)
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,15 @@
|
|||
- "pod1"
|
||||
- "pod2"
|
||||
|
||||
- name: Delete all container leftovers from tests
|
||||
containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
- "container1"
|
||||
- "container2"
|
||||
|
||||
- name: Create pod
|
||||
containers.podman.podman_pod:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
|
|
@ -860,7 +869,7 @@
|
|||
- name: Test idempotency for root pods
|
||||
include_tasks: root-pod.yml
|
||||
vars:
|
||||
ansible_python_interpreter: "/usr/bin/python"
|
||||
ansible_python_interpreter: "/usr/bin/python3"
|
||||
args:
|
||||
apply:
|
||||
become: true
|
||||
|
|
@ -868,7 +877,7 @@
|
|||
- name: Test idempotency for root pods and networks
|
||||
include_tasks: net-pod.yml
|
||||
vars:
|
||||
ansible_python_interpreter: "/usr/bin/python"
|
||||
ansible_python_interpreter: "/usr/bin/python3"
|
||||
args:
|
||||
apply:
|
||||
become: true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue