Skip to content
Snippets Groups Projects
Commit 864c0117 authored by David Trattnig's avatar David Trattnig
Browse files

Handle no-network case.

parent d903bf8c
No related branches found
No related tags found
No related merge requests found
...@@ -324,7 +324,11 @@ class Monitoring: ...@@ -324,7 +324,11 @@ class Monitoring:
""" """
Returns the IP of the Engine instance. Returns the IP of the Engine instance.
""" """
s = socket(AF_INET, SOCK_DGRAM) try:
s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) s = socket(AF_INET, SOCK_DGRAM)
s.connect(('<broadcast>', 0)) s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
return s.getsockname()[0] s.connect(('<broadcast>', 0))
return s.getsockname()[0]
except:
self.logger.critical(SimpleUtil.red("Error while accessing network via <broadcast>!"))
return "<UNKNOWN NETWORK>"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment