mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Raise an error if you overwrite an existing project
This commit is contained in:
2 files changed
+19
-3
No files matched your search
@@ -51,6 +51,12 @@ class Project:
|
||||
self._name = name
|
||||
self._auto_start = False
|
||||
self._status = status
|
||||
|
||||
# Disallow overwrite of existing project
|
||||
if project_id is None and path is not None:
|
||||
if os.path.exists(path):
|
||||
raise aiohttp.web.HTTPForbidden(text="The path {} already exist.".format(path))
|
||||
|
||||
if project_id is None:
|
||||
self._id = str(uuid4())
|
||||
else:
|
||||
@@ -187,7 +193,6 @@ class Project:
|
||||
return name
|
||||
raise aiohttp.web.HTTPConflict(text="A node name could not be allocated (node limit reached?)")
|
||||
|
||||
|
||||
def has_allocated_node_name(self, name):
|
||||
"""
|
||||
Returns either a node name is already allocated or not.
|
||||
|
||||
Reference in new issue
Block a user