From 22db13d2bf07a184f0df2feabb064451686b86c7 Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 8 Mar 2018 00:13:35 +0700 Subject: [PATCH] Fix bug preventing to export portable projects with IOU images. --- gns3server/controller/export_project.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gns3server/controller/export_project.py b/gns3server/controller/export_project.py index 75482f4b..9272984a 100644 --- a/gns3server/controller/export_project.py +++ b/gns3server/controller/export_project.py @@ -64,7 +64,6 @@ def export_project(project, temporary_dir, include_images=False, keep_compute_id for root, dirs, files in os.walk(project._path, topdown=True): files = [f for f in files if not _filter_files(os.path.join(root, f))] - for file in files: path = os.path.join(root, file) # Try open the file @@ -162,9 +161,12 @@ def _export_project_file(project, path, z, include_images, keep_compute_id, allo if "properties" in node and node["node_type"] != "docker": for prop, value in node["properties"].items(): - if not prop.endswith("image"): - continue + if node["node_type"] == "iou": + if not prop == "path": + continue + elif not prop.endswith("image"): + continue if value is None or value.strip() == '': continue @@ -214,7 +216,6 @@ def _export_local_images(project, image, z): continue directory = os.path.split(img_directory)[-1:][0] - if os.path.exists(image): path = image else: @@ -262,7 +263,6 @@ def _export_remote_images(project, compute_id, image_type, image, project_zipfil f.write(data) response.close() f.close() - arcname = os.path.join("images", image_type, image) + arcname = os.path.join("images", image_type.upper(), image) log.info("Saved {}".format(arcname)) project_zipfile.write(temp_path, arcname=arcname, compress_type=zipfile.ZIP_DEFLATED) -