From 1663c9e331ee2445ce86a2bca1a6cbd19dae64e1 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 30 Oct 2019 15:30:03 +0000 Subject: [PATCH] Check `host_ip` only once --- lib/galaxy_ext/container_monitor/monitor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/galaxy_ext/container_monitor/monitor.py b/lib/galaxy_ext/container_monitor/monitor.py index a64cb75d7d6..b1e1447f1e0 100644 --- a/lib/galaxy_ext/container_monitor/monitor.py +++ b/lib/galaxy_ext/container_monitor/monitor.py @@ -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: