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

Merge pull request #1119 from GNS3/fix_random_snap_failure

Test if a snapshot name already exists
This commit is contained in:
Jeremy Grossmann 2017-07-11 21:28:15 +07:00 committed by GitHub
commit d525f721a6

View File

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