1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Description: Gracefully handle API documentation builds during offline builds.
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Forwarded: https://code.x2go.org/gitweb?p=x2gobroker.git;a=commit;h=cc1b789e383dfcb8932daf05f1a22c0a1c998b0d
--- a/x2gobroker/defaults.py
+++ b/x2gobroker/defaults.py
@@ -204,10 +204,13 @@
### static / hard-coded defaults
###
-if socket.gethostname().find('.') >= 0:
- X2GOBROKER_HOSTNAME = socket.gethostname()
-else:
- X2GOBROKER_HOSTNAME = socket.gethostbyaddr(socket.gethostname())[0]
+try:
+ if socket.gethostname().find('.') >= 0:
+ X2GOBROKER_HOSTNAME = socket.gethostname()
+ else:
+ X2GOBROKER_HOSTNAME = socket.gethostbyaddr(socket.gethostname())[0]
+except socket.gaierror:
+ X2GOBROKER_HOSTNAME = 'localhost'
# the home directory of the user that the daemon/cgi runs as
X2GOBROKER_HOME = os.path.normpath(os.path.expanduser('~{broker_uid}'.format(broker_uid=X2GOBROKER_DAEMON_USER)))
|