Raise error if not started with --local

If you try to use a local server but you don't have started
it with --local we raise an error.
This commit is contained in:
Julien Duponchelle 2016-07-08 11:17:17 +02:00
parent 05df0a9bb6
commit 7e91a5cb11
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -201,6 +201,9 @@ class Controller:
try:
return self._computes[compute_id]
except KeyError:
server_config = Config.instance().get_section_config("Server")
if compute_id == "local" and server_config.getboolean("local", False) is False:
raise aiohttp.web.HTTPNotFound(text="You try to use a node on the local server but the controller is not started with --local")
raise aiohttp.web.HTTPNotFound(text="Compute ID {} doesn't exist".format(compute_id))
@asyncio.coroutine