##// END OF EJS Templates
parallel.apps.ipcontrollerapp: Use utils.localinterfaces...
W. Trevor King -
Show More
@@ -25,7 +25,6 b' from __future__ import with_statement'
25
25
26 import json
26 import json
27 import os
27 import os
28 import socket
29 import stat
28 import stat
30 import sys
29 import sys
31
30
@@ -45,6 +44,7 b' from IPython.parallel.apps.baseapp import ('
45 catch_config_error,
44 catch_config_error,
46 )
45 )
47 from IPython.utils.importstring import import_item
46 from IPython.utils.importstring import import_item
47 from IPython.utils.localinterfaces import LOCALHOST, PUBLIC_IPS
48 from IPython.utils.traitlets import Instance, Unicode, Bool, List, Dict, TraitError
48 from IPython.utils.traitlets import Instance, Unicode, Bool, List, Dict, TraitError
49
49
50 from IPython.zmq.session import (
50 from IPython.zmq.session import (
@@ -220,13 +220,13 b' class IPControllerApp(BaseParallelApplication):'
220 location = cdict['location']
220 location = cdict['location']
221
221
222 if not location:
222 if not location:
223 try:
223 if PUBLIC_IPS:
224 location = socket.gethostbyname_ex(socket.gethostname())[2][-1]
224 location = PUBLIC_IPS[-1]
225 except (socket.gaierror, IndexError):
225 else:
226 self.log.warn("Could not identify this machine's IP, assuming 127.0.0.1."
226 self.log.warn("Could not identify this machine's IP, assuming %s."
227 " You may need to specify '--location=<external_ip_address>' to help"
227 " You may need to specify '--location=<external_ip_address>' to help"
228 " IPython decide when to connect via loopback.")
228 " IPython decide when to connect via loopback." % LOCALHOST)
229 location = '127.0.0.1'
229 location = LOCALHOST
230 cdict['location'] = location
230 cdict['location'] = location
231 fname = os.path.join(self.profile_dir.security_dir, fname)
231 fname = os.path.join(self.profile_dir.security_dir, fname)
232 self.log.info("writing connection info to %s", fname)
232 self.log.info("writing connection info to %s", fname)
General Comments 0
You need to be logged in to leave comments. Login now