mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Fix a warning when export
This commit is contained in:
3 files changed
+9
-7
No files matched your search
@@ -299,7 +299,7 @@ class Compute:
|
||||
response = yield from self._session().request("GET", url, auth=self._auth)
|
||||
if response.status == 404:
|
||||
raise aiohttp.web.HTTPNotFound(text="{} not found on compute".format(path))
|
||||
return response.content
|
||||
return response
|
||||
|
||||
@asyncio.coroutine
|
||||
def stream_file(self, project, path):
|
||||
|
||||
@@ -75,12 +75,13 @@ def export_project(project, temporary_dir, include_images=False, keep_compute_id
|
||||
if not _filter_files(compute_file["path"]):
|
||||
(fd, temp_path) = tempfile.mkstemp(dir=temporary_dir)
|
||||
f = open(fd, "wb", closefd=True)
|
||||
stream = yield from compute.download_file(project, compute_file["path"])
|
||||
response = yield from compute.download_file(project, compute_file["path"])
|
||||
while True:
|
||||
data = yield from stream.read(512)
|
||||
data = yield from response.content.read(512)
|
||||
if not data:
|
||||
break
|
||||
f.write(data)
|
||||
response.close()
|
||||
f.close()
|
||||
z.write(temp_path, arcname=compute_file["path"], compress_type=zipfile.ZIP_DEFLATED)
|
||||
return z
|
||||
|
||||
Reference in new issue
Block a user