From 05d2579907608f6549a24ec239d556e229f0929e Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 8 Dec 2021 00:01:25 +1030 Subject: [PATCH] Do not automatically install appliance after uploading image --- gns3server/api/routes/controller/images.py | 2 +- gns3server/services/templates.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gns3server/api/routes/controller/images.py b/gns3server/api/routes/controller/images.py index d8d8e193..ccd15b76 100644 --- a/gns3server/api/routes/controller/images.py +++ b/gns3server/api/routes/controller/images.py @@ -67,7 +67,7 @@ async def upload_image( templates_repo: TemplatesRepository = Depends(get_repository(TemplatesRepository)), current_user: schemas.User = Depends(get_current_active_user), rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)), - install_appliances: Optional[bool] = True + install_appliances: Optional[bool] = False ) -> schemas.Image: """ Upload an image. diff --git a/gns3server/services/templates.py b/gns3server/services/templates.py index 8270a703..6bcaa0ce 100644 --- a/gns3server/services/templates.py +++ b/gns3server/services/templates.py @@ -181,8 +181,10 @@ class TemplatesService: async def _find_image(self, image_path: str): image = await self._templates_repo.get_image(image_path) - if not image or not os.path.exists(image.path): - raise ControllerNotFoundError(f"Image '{image_path}' could not be found") + if not image: + raise ControllerNotFoundError(f"Image '{image.filename}' could not be found in the controller database") + if not os.path.exists(image.path): + raise ControllerNotFoundError(f"Image '{image.path}' could not be found on disk") return image async def _find_images(self, template_type: str, settings: dict) -> List[models.Image]: