We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 36f7ca2 commit 7e8522bCopy full SHA for 7e8522b
1 file changed
smoketests/docker.py
@@ -57,11 +57,12 @@ def host_ports(self, docker) -> set[int]:
57
"""
58
host_ports = set()
59
info = docker.inspect_container(self)
60
- for ports in info['NetworkSettings']['Ports'].values():
61
- for ip_and_port in ports:
62
- host_port = ip_and_port.get("HostPort")
63
- if host_port:
64
- host_ports.add(host_port)
+ for ports in info.get('NetworkSettings', {}).get('Ports', {}).values():
+ if ports:
+ for ip_and_port in ports:
+ host_port = ip_and_port.get("HostPort")
+ if host_port:
65
+ host_ports.add(host_port)
66
return host_ports
67
68
def is_running(self, docker, ping_url: Callable[[int], str]) -> bool:
0 commit comments