Check host_ip only once

This commit is contained in:
Nicola Soranzo
2019-10-30 15:30:03 +00:00
committed by GitHub
parent 391381d3c4
commit 1663c9e331
+4 -3
View File
@@ -48,9 +48,10 @@ def main():
host_ip = None
with open("container_runtime.json", "w") as f:
ports = docker_util.parse_port_text(ports_raw)
for key in ports:
if ports[key]['host'] == '0.0.0.0' and host_ip is not None:
ports[key]['host'] = host_ip
if host_ip is not None:
for key in ports:
if ports[key]['host'] == '0.0.0.0':
ports[key]['host'] = host_ip
json.dump(ports, f)
break
else: