mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #8901 from jmchilton/revert_ip_adjustments
[19.09] Revert hacking IPs in container monitor script.
This commit is contained in:
@@ -225,6 +225,12 @@ def _docker_prefix(
|
||||
|
||||
|
||||
def parse_port_text(port_text):
|
||||
"""
|
||||
|
||||
>>> slurm_ports = parse_port_text("8888/tcp -> 0.0.0.0:32769")
|
||||
>>> slurm_ports[8888]['host']
|
||||
'0.0.0.0'
|
||||
"""
|
||||
ports = None
|
||||
if port_text is not None:
|
||||
ports = {}
|
||||
|
||||
@@ -41,12 +41,17 @@ def main():
|
||||
try:
|
||||
ports_raw = parse_ports(container_name, connection_configuration)
|
||||
if ports_raw is not None:
|
||||
host_ip = socket.gethostbyname(socket.gethostname())
|
||||
try:
|
||||
host_ip = socket.gethostbyname(socket.gethostname())
|
||||
except Exception:
|
||||
# doesn't work on OS X
|
||||
host_ip = None
|
||||
with open("container_runtime.json", "w") as f:
|
||||
# Override the IPs
|
||||
ports = docker_util.parse_port_text(ports_raw)
|
||||
for key in ports:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user