only use the slice's public IP if NAT is enabled
[mpi-image.git] / scripts / orted
1 #! /usr/bin/python
2
3 import subprocess
4 import sys
5 import os
6
7 if "SSH_CONNECTION" in os.environ:
8     parts = os.environ["SSH_CONNECTION"].split()
9     remote_ip = parts[0]
10 else:
11     remote_ip = None
12
13 newargs = []
14 for arg in sys.argv[1:]:
15    if ("tcp://192.168" in arg) and (remote_ip is not None):
16        parts = arg.split(":")
17        parts[1]="//" + remote_ip # "//128.112.171.38"
18        arg=":".join(parts)
19    newargs.append(arg)
20
21 subprocess.call(["/usr/lib64/openmpi/bin/orted"] + newargs)