mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-15 19:42:06 +00:00
Port spec can be a list of port specs.
This commit is contained in:
parent
6b0d665bee
commit
3f8ccef669
@ -2089,16 +2089,26 @@ def _preprocess_value_ports(
|
||||
if "published_ports" not in values:
|
||||
return values
|
||||
found = False
|
||||
for port_spec in values["published_ports"].values():
|
||||
if port_spec[0] == _DEFAULT_IP_REPLACEMENT_STRING:
|
||||
found = True
|
||||
break
|
||||
for port_specs in values["published_ports"].values():
|
||||
if not isinstance(port_specs, list):
|
||||
port_specs = [port_specs]
|
||||
for port_spec in port_specs:
|
||||
if port_spec[0] == _DEFAULT_IP_REPLACEMENT_STRING:
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
return values
|
||||
default_ip = _get_default_host_ip(module, client)
|
||||
for port, port_spec in values["published_ports"].items():
|
||||
if port_spec[0] == _DEFAULT_IP_REPLACEMENT_STRING:
|
||||
values["published_ports"][port] = tuple([default_ip] + list(port_spec[1:]))
|
||||
for port, port_specs in values["published_ports"].items():
|
||||
if isinstance(port_specs, list):
|
||||
for index, port_spec in enumerate(port_specs):
|
||||
if port_spec[0] == _DEFAULT_IP_REPLACEMENT_STRING:
|
||||
port_specs[index] = tuple([default_ip] + list(port_spec[1:]))
|
||||
else:
|
||||
if port_specs[0] == _DEFAULT_IP_REPLACEMENT_STRING:
|
||||
values["published_ports"][port] = tuple(
|
||||
[default_ip] + list(port_specs[1:])
|
||||
)
|
||||
return values
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user