Unverified Commit fd18995c authored by ybyang's avatar ybyang Committed by GitHub
Browse files

Fix get_ip when no external network (#9700)

parent db0831e0
......@@ -1964,6 +1964,15 @@ def get_ip() -> str:
except Exception:
pass
# try using hostname
hostname = socket.gethostname()
try:
ip_addr = socket.gethostbyname(hostname)
warnings.warn("using local ip address: {}".format(ip_addr))
return ip_addr
except Exception:
pass
warnings.warn(
"Failed to get the IP address, using 0.0.0.0 by default."
"The value can be set by the environment variable"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment