Catch error when the server as trouble to access to itself

Fix #940
This commit is contained in:
Julien Duponchelle 2017-03-16 10:50:08 +01:00
parent 08bafc2dcc
commit 6a015fffeb
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import json
import socket
import asyncio
@ -68,6 +69,7 @@ class Controller:
name = "Main server"
computes = yield from self._load_controller_settings()
try:
yield from self.add_compute(compute_id="local",
name=name,
protocol=server_config.get("protocol", "http"),
@ -77,6 +79,9 @@ class Controller:
user=server_config.get("user", ""),
password=server_config.get("password", ""),
force=True)
except aiohttp.web_exceptions.HTTPConflict as e:
log.fatal("Can't acces to the local server, make sure anything else is not running on the same port")
sys.exit(1)
for c in computes:
try:
yield from self.add_compute(**c)