1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-05-02 05:42:51 +00:00

Add IPv6 support for publishing ports (#226)

This commit is contained in:
Sergey 2021-03-31 18:28:46 +03:00 committed by GitHub
parent ed3a3dc080
commit d87777394b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 87 additions and 4 deletions

View file

@ -1043,9 +1043,12 @@ class PodmanContainerDiff:
# TODO(sshnaidm) Need to add port ranges support
def diffparam_publish(self):
def compose(p, h):
return ":".join(
[h['hostip'], str(h["hostport"]), p.replace('/tcp', '')]
s = ":".join(
[str(h["hostport"]), p.replace('/tcp', '')]
).strip(":")
if h['hostip']:
return ":".join([h['hostip'], s])
return s
ports = self.info['hostconfig']['portbindings']
before = []
@ -1057,7 +1060,9 @@ class PodmanContainerDiff:
image_ports = self.image_info['config'].get('exposedports', {})
if image_ports:
after += list(image_ports.keys())
after = [i.replace("/tcp", "") for i in after]
after = [
i.replace("/tcp", "").replace("[", "").replace("]", "")
for i in after]
# No support for port ranges yet
for ports in after:
if "-" in ports:

View file

@ -380,7 +380,9 @@ class PodmanPodDiff:
i.replace('/tcp', '')
]).strip(':') for i, j in ports.items()]
after = self.params['publish'] or []
after = [i.replace("/tcp", "") for i in after]
after = [
i.replace("/tcp", "").replace("[", "").replace("]", "").strip(":")
for i in after]
# No support for port ranges yet
for ports in after:
if "-" in ports: