mirror of
https://github.com/GNS3/gns3-server
synced 2025-07-14 10:38:26 +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:
parent
d17b4eb053
commit
450c089b6d
@ -510,6 +510,9 @@ class Project:
|
|||||||
:param name: Name of the snapshot
|
: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)
|
snapshot = Snapshot(self, name=name)
|
||||||
try:
|
try:
|
||||||
if os.path.exists(snapshot.path):
|
if os.path.exists(snapshot.path):
|
||||||
|
Loading…
Reference in New Issue
Block a user