diff --git a/gns3server/handlers/upload_handler.py b/gns3server/handlers/upload_handler.py index a4a9396e..0e0a7291 100644 --- a/gns3server/handlers/upload_handler.py +++ b/gns3server/handlers/upload_handler.py @@ -16,6 +16,7 @@ # along with this program. If not, see . import os +import aiohttp import stat from ..config import Config @@ -56,7 +57,7 @@ class UploadHandler: return if data["type"] not in ["IOU", "IOURC", "QEMU", "IOS"]: - raise HTTPForbidden("You are not authorized to upload this kind of image {}".format(data["type"])) + raise aiohttp.web.HTTPForbidden("You are not authorized to upload this kind of image {}".format(data["type"])) if data["type"] == "IOURC": destination_dir = os.path.expanduser("~/") diff --git a/gns3server/modules/base_manager.py b/gns3server/modules/base_manager.py index 9c642c7d..23a4e34d 100644 --- a/gns3server/modules/base_manager.py +++ b/gns3server/modules/base_manager.py @@ -175,17 +175,17 @@ class BaseManager: new_project_files_path, e)) if project.is_local() is False: - legacy_remote_iou_project = os.path.join(project.location, project.name, "iou") - new_iou_project_path = os.path.join(project.path, "project-files", "iou") - if os.path.exists(legacy_remote_iou_project) and not os.path.exists(new_iou_project_path): - # move the legacy remote IOU project (remote servers only) - log.info("Converting old remote IOU project...") + legacy_remote_project_path = os.path.join(project.location, project.name, self.module_name.lower()) + new_remote_project_path = os.path.join(project.path, "project-files", self.module_name.lower()) + if os.path.exists(legacy_remote_project_path) and not os.path.exists(new_remote_project_path): + # move the legacy remote project (remote servers only) + log.info("Converting old remote project...") try: - log.info('Moving "{}" to "{}"'.format(legacy_remote_iou_project, new_iou_project_path)) - yield from wait_run_in_executor(shutil.move, legacy_remote_iou_project, new_iou_project_path) + log.info('Moving "{}" to "{}"'.format(legacy_remote_project_path, new_remote_project_path)) + yield from wait_run_in_executor(shutil.move, legacy_remote_project_path, new_remote_project_path) except OSError as e: - raise aiohttp.web.HTTPInternalServerError(text="Could not move IOU directory: {} to {} {}".format(legacy_remote_iou_project, - new_iou_project_path, e)) + raise aiohttp.web.HTTPInternalServerError(text="Could not move directory: {} to {} {}".format(legacy_remote_project_path, + new_remote_project_path, e)) if hasattr(self, "get_legacy_vm_workdir"): # rename old project VM working dir