Merge branch '2.1' into embed_appliances

This commit is contained in:
Julien Duponchelle committed 2017-02-28 14:55:33 +01:00
commit 5a399b90fe
68 files changed
+1527 -484

No files matched your search

@@ -344,10 +344,7 @@ class NodeHandler:
raise aiohttp.web.HTTPForbidden
node_type = node.node_type
if node_type == "dynamips":
path = "/project-files/{}/{}".format(node_type, path)
else:
path = "/project-files/{}/{}/{}".format(node_type, node.id, path)
path = "/project-files/{}/{}/{}".format(node_type, node.id, path)
res = yield from node.compute.http_query("GET", "/projects/{project_id}/files{path}".format(project_id=project.id, path=path), timeout=None, raw=True)
response.set_status(200)
@@ -384,12 +381,9 @@ class NodeHandler:
raise aiohttp.web.HTTPForbidden
node_type = node.node_type
if node_type == "dynamips":
path = "/project-files/{}/{}".format(node_type, path)
else:
path = "/project-files/{}/{}/{}".format(node_type, node.id, path)
path = "/project-files/{}/{}/{}".format(node_type, node.id, path)
data = yield from request.content.read()
res = yield from node.compute.http_query("POST", "/projects/{project_id}/files{path}".format(project_id=project.id, path=path), data=data, timeout=None, raw=True)
yield from node.compute.http_query("POST", "/projects/{project_id}/files{path}".format(project_id=project.id, path=path), data=data, timeout=None, raw=True)
response.set_status(201)
@@ -114,7 +114,10 @@ class ServerHandler:
def write_settings(request, response):
controller = Controller.instance()
controller.settings = request.json
controller.save()
try:
controller.save()
except (OSError, PermissionError) as e:
raise HTTPConflict(text="Can't save the settings {}".format(str(e)))
response.json(controller.settings)
response.set_status(201)