mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 22:11:14 +02:00
Allow to have projects with the same name in different locations.
This commit is contained in:
1 parent
ea0009db6c
commit
509b171b06
7 files changed
+15
-8
No files matched your search
@@ -535,7 +535,7 @@ class Controller:
|
||||
return compute_id in self._computes
|
||||
|
||||
@asyncio.coroutine
|
||||
def add_project(self, project_id=None, name=None, **kwargs):
|
||||
def add_project(self, project_id=None, name=None, path=None, **kwargs):
|
||||
"""
|
||||
Creates a project or returns an existing project
|
||||
|
||||
@@ -547,8 +547,11 @@ class Controller:
|
||||
if project_id not in self._projects:
|
||||
for project in self._projects.values():
|
||||
if name and project.name == name:
|
||||
raise aiohttp.web.HTTPConflict(text='Project name "{}" already exists'.format(name))
|
||||
project = Project(project_id=project_id, controller=self, name=name, **kwargs)
|
||||
if path and path == project.path:
|
||||
raise aiohttp.web.HTTPConflict(text='Project "{}" already exists in location "{}"'.format(name, path))
|
||||
else:
|
||||
raise aiohttp.web.HTTPConflict(text='Project "{}" already exists'.format(name))
|
||||
project = Project(project_id=project_id, controller=self, name=name, path=path, **kwargs)
|
||||
self._projects[project.id] = project
|
||||
return self._projects[project.id]
|
||||
return self._projects[project_id]
|
||||
|
||||
Reference in new issue
Block a user