Commit 8d676e88 authored by Daniele Venzano's avatar Daniele Venzano

Fix getting address for terminates containers

parent 4901bd55
......@@ -263,15 +263,16 @@ class SwarmClient:
info["running"] = False
info['ports'] = {}
for port in docker_info['NetworkSettings']['Ports']:
if docker_info['NetworkSettings']['Ports'][port] is not None:
mapping = (
docker_info['NetworkSettings']['Ports'][port][0]['HostIp'],
docker_info['NetworkSettings']['Ports'][port][0]['HostPort']
)
info['ports'][port] = mapping
else:
info['ports'][port] = None
if docker_info['NetworkSettings'] is not None:
for port in docker_info['NetworkSettings']['Ports']:
if docker_info['NetworkSettings']['Ports'][port] is not None:
mapping = (
docker_info['NetworkSettings']['Ports'][port][0]['HostIp'],
docker_info['NetworkSettings']['Ports'][port][0]['HostPort']
)
info['ports'][port] = mapping
else:
info['ports'][port] = None
return info
def terminate_container(self, docker_id: str, delete=False) -> None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment