mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-22 00:41:56 +00:00
When importing a project fix the GNS3 version
This commit is contained in:
@ -67,17 +67,19 @@ def export_project(project, temporary_dir, include_images=False):
|
||||
z.write(path, os.path.relpath(path, project._path), compress_type=zipfile.ZIP_DEFLATED)
|
||||
|
||||
for compute in project.computes:
|
||||
if compute.id == "vm":
|
||||
if compute.id != "local":
|
||||
compute_files = yield from compute.list_files(project)
|
||||
for compute_file in compute_files:
|
||||
if not _filter_files(compute_file["path"]):
|
||||
(fp, temp_path) = tempfile.mkstemp(dir=temporary_dir)
|
||||
(fd, temp_path) = tempfile.mkstemp(dir=temporary_dir)
|
||||
f = open(fd, "wb", closefd=True)
|
||||
stream = yield from compute.download_file(project, compute_file["path"])
|
||||
while True:
|
||||
data = yield from stream.read(512)
|
||||
if not data:
|
||||
break
|
||||
fp.write(data)
|
||||
f.write(data)
|
||||
f.close()
|
||||
z.write(temp_path, arcname=compute_file["path"], compress_type=zipfile.ZIP_DEFLATED)
|
||||
return z
|
||||
|
||||
@ -102,7 +104,6 @@ def _filter_files(path):
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def _export_project_file(project, path, z, include_images):
|
||||
"""
|
||||
Take a project file (.gns3) and patch it for the export
|
||||
|
Reference in New Issue
Block a user