1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

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
This commit is contained in:
Julien Duponchelle 2017-07-11 15:28:01 +02:00
parent d17b4eb053
commit 450c089b6d
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -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):