Merge pull request #2717 from GNS3/bugfix/2709

Fix snapshot restore does not work after export/import of project
This commit is contained in:
Jeremy Grossmann 2026-05-08 18:59:37 +08:00 committed by GitHub
commit 2dcbe0f1c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -316,7 +316,7 @@ async def update_snapshots(snapshots_dir, project_path, project_name, project_id
topology = json.load(f)
topology["name"] = project_name
topology["project_id"] = project_id
regenerate_topology_ids(topology, project_path, reset_mac_addresses)
regenerate_topology_ids(topology, tmpdir, reset_mac_addresses)
with open(topology_file_path, "w+", encoding="utf-8") as f:
json.dump(topology, f, indent=4, sort_keys=True)
except OSError as e:

View File

@ -139,7 +139,7 @@ class Snapshot:
# delete the current project files
project_files_path = os.path.join(self._project.path, "project-files")
if os.path.exists(project_files_path):
await wait_run_in_executor(shutil.rmtree, project_files_path)
await wait_run_in_executor(shutil.rmtree, project_files_path, ignore_errors=True)
with open(self._path, "rb") as f:
project = await import_project(
self._project.controller,