mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
Fix idempotency for podman > 2 versions
In podman 2.0.0 were introduced changes in inspection of container. Support all idempotency changes from version 2.
This commit is contained in:
parent
70b7727327
commit
63fd0545e4
1 changed files with 18 additions and 5 deletions
|
|
@ -1291,6 +1291,11 @@ class PodmanDefaults:
|
|||
if (LooseVersion(self.version) >= LooseVersion('1.8.0')
|
||||
and LooseVersion(self.version) < LooseVersion('1.9.0')):
|
||||
self.defaults['cpu_shares'] = 1024
|
||||
if (LooseVersion(self.version) >= LooseVersion('2.0.0')):
|
||||
self.defaults['network'] = ["slirp4netns"]
|
||||
self.defaults['ipc'] = "private"
|
||||
self.defaults['uts'] = "private"
|
||||
self.defaults['pid'] = "private"
|
||||
return self.defaults
|
||||
|
||||
|
||||
|
|
@ -1621,11 +1626,19 @@ class PodmanContainerDiff:
|
|||
# TODO(sshnaidm) Need to add port ranges support
|
||||
def diffparam_publish(self):
|
||||
ports = self.info['networksettings']['ports']
|
||||
before = [":".join([
|
||||
i['hostip'],
|
||||
str(i["hostport"]),
|
||||
str(i["containerport"])
|
||||
]).strip(':') for i in ports]
|
||||
# before 2.0.0 we have ports as a list, after 2.0.0 it's a dictionary
|
||||
if isinstance(ports, list):
|
||||
before = [":".join([
|
||||
i['hostip'],
|
||||
str(i["hostport"]),
|
||||
str(i["containerport"])
|
||||
]).strip(':') for i in ports]
|
||||
elif isinstance(ports, dict):
|
||||
before = [":".join([
|
||||
j[0]['hostip'],
|
||||
str(j[0]["hostport"]),
|
||||
i.replace('/tcp', '')
|
||||
]).strip(':') for i, j in ports.items()]
|
||||
after = self.params['publish'] or []
|
||||
if self.params['publish_all']:
|
||||
image_ports = self.image_info['config'].get('exposedports', {})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue