Show More
@@ -192,7 +192,13 b' class IPControllerApp(BaseParallelApplication):' | |||
|
192 | 192 | except AssertionError: |
|
193 | 193 | pass |
|
194 | 194 | else: |
|
195 | location = socket.gethostbyname_ex(socket.gethostname())[2][-1] | |
|
195 | try: | |
|
196 | location = socket.gethostbyname_ex(socket.gethostname())[2][-1] | |
|
197 | except (socket.gaierror, IndexError): | |
|
198 | self.log.warn("Could not identify this machine's IP, assuming 127.0.0.1." | |
|
199 | " You may need to specify '--location=<external_ip_address>' to help" | |
|
200 | " IPython decide when to connect via loopback.") | |
|
201 | location = '127.0.0.1' | |
|
196 | 202 | cdict['location'] = location |
|
197 | 203 | fname = os.path.join(self.profile_dir.security_dir, fname) |
|
198 | 204 | with open(fname, 'wb') as f: |
@@ -166,8 +166,13 b' def disambiguate_ip_address(ip, location=None):' | |||
|
166 | 166 | """turn multi-ip interfaces '0.0.0.0' and '*' into connectable |
|
167 | 167 | ones, based on the location (default interpretation of location is localhost).""" |
|
168 | 168 | if ip in ('0.0.0.0', '*'): |
|
169 | external_ips = socket.gethostbyname_ex(socket.gethostname())[2] | |
|
170 | if location is None or location in external_ips: | |
|
169 | try: | |
|
170 | external_ips = socket.gethostbyname_ex(socket.gethostname())[2] | |
|
171 | except (socket.gaierror, IndexError): | |
|
172 | # couldn't identify this machine, assume localhost | |
|
173 | external_ips = [] | |
|
174 | if location is None or location in external_ips or not external_ips: | |
|
175 | # If location is unspecified or cannot be determined, assume local | |
|
171 | 176 | ip='127.0.0.1' |
|
172 | 177 | elif location: |
|
173 | 178 | return location |
General Comments 0
You need to be logged in to leave comments.
Login now