diff --git a/gns3server/controller/import_project.py b/gns3server/controller/import_project.py index 678de2ac..aa7886f4 100644 --- a/gns3server/controller/import_project.py +++ b/gns3server/controller/import_project.py @@ -38,7 +38,8 @@ Handle the import of project from a .gns3project """ -async def import_project(controller, project_id, stream, location=None, name=None, keep_compute_id=False): +async def import_project(controller, project_id, stream, location=None, name=None, keep_compute_id=False, + auto_start=False, auto_open=False, auto_close=True): """ Import a project contain in a zip file @@ -98,9 +99,9 @@ async def import_project(controller, project_id, stream, location=None, name=Non topology = load_topology(os.path.join(path, "project.gns3")) topology["name"] = project_name # To avoid unexpected behavior (project start without manual operations just after import) - topology["auto_start"] = False - topology["auto_open"] = False - topology["auto_close"] = True + topology["auto_start"] = auto_start + topology["auto_open"] = auto_open + topology["auto_close"] = auto_close # Generate a new node id node_old_to_new = {} diff --git a/gns3server/controller/snapshot.py b/gns3server/controller/snapshot.py index 8bb2b00c..792a9261 100644 --- a/gns3server/controller/snapshot.py +++ b/gns3server/controller/snapshot.py @@ -121,7 +121,9 @@ class Snapshot: if os.path.exists(project_files_path): await wait_run_in_executor(shutil.rmtree, project_files_path) with open(self._path, "rb") as f: - project = await import_project(self._project.controller, self._project.id, f, location=self._project.path) + project = await import_project(self._project.controller, self._project.id, f, location=self._project.path, + auto_start=self._project.auto_start, auto_open=self._project.auto_open, + auto_close=self._project.auto_close) except (OSError, PermissionError) as e: raise aiohttp.web.HTTPConflict(text=str(e)) await project.open()