1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-03-22 02:29:08 +00:00

Add slirp4netns idempotency for pods (#369)

Fix #367
This commit is contained in:
Sergey 2022-01-16 23:44:08 +02:00 committed by GitHub
parent 71117a3a86
commit 547abfea53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 0 deletions

View file

@ -415,6 +415,13 @@ class PodmanPodDiff:
if before == ['podman']:
before = []
after = self.params['network']
# Special case for options for slirp4netns rootless networking from v2
if net_mode_before == 'slirp4netns' and 'createcommand' in self.info:
cr_com = self.info['createcommand']
if '--network' in cr_com:
cr_net = cr_com[cr_com.index('--network') + 1].lower()
if 'slirp4netns:' in cr_net:
before = [cr_net]
# Currently supported only 'host' and 'none' network modes idempotency
if after in ['bridge', 'host', 'slirp4netns']:
net_mode_after = after