mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Merge branch '2.1' into 2.2
# Conflicts: # gns3server/compute/builtin/nodes/cloud.py # gns3server/compute/docker/docker_vm.py # gns3server/compute/dynamips/nodes/ethernet_switch.py # gns3server/compute/iou/iou_vm.py # gns3server/compute/qemu/qemu_vm.py # gns3server/compute/virtualbox/virtualbox_vm.py # gns3server/compute/vmware/vmware_vm.py # gns3server/controller/__init__.py # gns3server/version.py # gns3server/web/web_server.py
This commit is contained in:
commit
9de13c570c
36 files changed
+316
-93
No files matched your search
@@ -59,7 +59,7 @@ class ComputeHandler:
|
||||
|
||||
@Route.put(
|
||||
r"/computes/{compute_id}",
|
||||
description="Get a compute server information",
|
||||
description="Update a compute server",
|
||||
status_codes={
|
||||
200: "Compute server updated",
|
||||
400: "Invalid request",
|
||||
|
||||
@@ -302,9 +302,9 @@ class ProjectHandler:
|
||||
|
||||
try:
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
datas = yield from export_project(
|
||||
project, tmp_dir,
|
||||
include_images=bool(int(request.query.get("include_images", "0"))))
|
||||
stream = yield from export_project(project,
|
||||
tmp_dir,
|
||||
include_images=bool(int(request.query.get("include_images", "0"))))
|
||||
# We need to do that now because export could failed and raise an HTTP error
|
||||
# that why response start need to be the later possible
|
||||
response.content_type = 'application/gns3project'
|
||||
@@ -312,7 +312,7 @@ class ProjectHandler:
|
||||
response.enable_chunked_encoding()
|
||||
yield from response.prepare(request)
|
||||
|
||||
for data in datas:
|
||||
for data in stream:
|
||||
response.write(data)
|
||||
yield from response.drain()
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ class ServerHandler:
|
||||
r"/debug",
|
||||
description="Dump debug information to disk (debug directory in config directory). Work only for local server",
|
||||
status_codes={
|
||||
201: "Writed"
|
||||
201: "Written"
|
||||
})
|
||||
def debug(request, response):
|
||||
|
||||
@@ -157,7 +157,7 @@ class ServerHandler:
|
||||
f.write(ServerHandler._getDebugData())
|
||||
except Exception as e:
|
||||
# If something is wrong we log the info to the log and we hope the log will be include correctly to the debug export
|
||||
log.error("Could not export debug informations {}".format(e), exc_info=1)
|
||||
log.error("Could not export debug information {}".format(e), exc_info=1)
|
||||
|
||||
try:
|
||||
if Controller.instance().gns3vm.engine == "vmware":
|
||||
|
||||
@@ -52,7 +52,8 @@ class SymbolHandler:
|
||||
controller = Controller.instance()
|
||||
try:
|
||||
yield from response.file(controller.symbols.get_path(request.match_info["symbol_id"]))
|
||||
except (KeyError, FileNotFoundError, PermissionError):
|
||||
except (KeyError, OSError) as e:
|
||||
log.warning("Could not get symbol file: {}".format(e))
|
||||
response.set_status(404)
|
||||
|
||||
@Route.post(
|
||||
@@ -66,7 +67,7 @@ class SymbolHandler:
|
||||
controller = Controller.instance()
|
||||
path = os.path.join(controller.symbols.symbols_path(), os.path.basename(request.match_info["symbol_id"]))
|
||||
try:
|
||||
with open(path, 'wb') as f:
|
||||
with open(path, "wb") as f:
|
||||
while True:
|
||||
try:
|
||||
chunk = yield from request.content.read(1024)
|
||||
@@ -75,7 +76,7 @@ class SymbolHandler:
|
||||
if not chunk:
|
||||
break
|
||||
f.write(chunk)
|
||||
except OSError as e:
|
||||
except (UnicodeEncodeError, OSError) as e:
|
||||
raise aiohttp.web.HTTPConflict(text="Could not write symbol file '{}': {}".format(path, e))
|
||||
# Reset the symbol list
|
||||
controller.symbols.list()
|
||||
|
||||
Reference in new issue
Block a user