From 450c089b6d3d3a7fad435d9c16dc250049869be0 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 11 Jul 2017 15:28:01 +0200 Subject: [PATCH] Test if a snapshot name already exists This fix random test failure when testing snapshots. It seem under high load sometimes the previous snapshot folder was not visible on disk. Perhaps a test isolation issue but I don't see how. But in any case it's better to test if the name is not already use. Fix #1118 --- gns3server/controller/project.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gns3server/controller/project.py b/gns3server/controller/project.py index c185cccd..93e8f31c 100644 --- a/gns3server/controller/project.py +++ b/gns3server/controller/project.py @@ -510,6 +510,9 @@ class Project: :param name: Name of the snapshot """ + if name in [snap.name for snap in self.snapshots.values()]: + raise aiohttp.web_exceptions.HTTPConflict(text="The snapshot {} already exist".format(name)) + snapshot = Snapshot(self, name=name) try: if os.path.exists(snapshot.path):