mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Drop the commit system
Ref https://github.com/GNS3/gns3-gui/issues/1243
This commit is contained in:
9 files changed
+2
-150
No files matched your search
@@ -288,16 +288,6 @@ class BaseManager:
|
||||
|
||||
pass
|
||||
|
||||
@asyncio.coroutine
|
||||
def project_committed(self, project):
|
||||
"""
|
||||
Called when a project is committed.
|
||||
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
@asyncio.coroutine
|
||||
def delete_node(self, node_id):
|
||||
"""
|
||||
@@ -309,7 +299,7 @@ class BaseManager:
|
||||
|
||||
node = yield from self.close_node(node_id)
|
||||
node.project.emit("node.deleted", node)
|
||||
node.project.mark_node_for_destruction(node)
|
||||
yield from node.project.remove_node(node)
|
||||
if node.id in self._nodes:
|
||||
del self._nodes[node.id]
|
||||
return node
|
||||
|
||||
@@ -239,23 +239,6 @@ class Dynamips(BaseManager):
|
||||
if device.project.id == project.id:
|
||||
yield from device.hypervisor.set_working_dir(project.module_working_directory(self.module_name.lower()))
|
||||
|
||||
@asyncio.coroutine
|
||||
def project_committed(self, project):
|
||||
"""
|
||||
Called when a project has been committed.
|
||||
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
# save the configs when the project is committed
|
||||
for node in self._nodes.copy().values():
|
||||
if node.project.id == project.id:
|
||||
try:
|
||||
yield from node.save_configs()
|
||||
except DynamipsError as e:
|
||||
log.warning(e)
|
||||
continue
|
||||
|
||||
@property
|
||||
def dynamips_path(self):
|
||||
"""
|
||||
|
||||
@@ -56,7 +56,6 @@ class Project:
|
||||
self._id = project_id
|
||||
|
||||
self._nodes = set()
|
||||
self._nodes_to_destroy = set()
|
||||
self._used_tcp_ports = set()
|
||||
self._used_udp_ports = set()
|
||||
|
||||
@@ -231,14 +230,6 @@ class Project:
|
||||
raise aiohttp.web.HTTPInternalServerError(text="Could not create the capture working directory: {}".format(e))
|
||||
return workdir
|
||||
|
||||
def mark_node_for_destruction(self, node):
|
||||
"""
|
||||
:param node: An instance of Node
|
||||
"""
|
||||
|
||||
self.remove_node(node)
|
||||
self._nodes_to_destroy.add(node)
|
||||
|
||||
def add_node(self, node):
|
||||
"""
|
||||
Adds a node to the project.
|
||||
@@ -258,6 +249,7 @@ class Project:
|
||||
"""
|
||||
|
||||
if node in self._nodes:
|
||||
yield from node.delete()
|
||||
self._nodes.remove(node)
|
||||
|
||||
@asyncio.coroutine
|
||||
@@ -319,19 +311,6 @@ class Project:
|
||||
for port in self._used_udp_ports.copy():
|
||||
port_manager.release_udp_port(port, self)
|
||||
|
||||
@asyncio.coroutine
|
||||
def commit(self):
|
||||
"""
|
||||
Writes project changes on disk
|
||||
"""
|
||||
|
||||
while self._nodes_to_destroy:
|
||||
node = self._nodes_to_destroy.pop()
|
||||
yield from node.delete()
|
||||
self.remove_node(node)
|
||||
for module in self.compute():
|
||||
yield from module.instance().project_committed(self)
|
||||
|
||||
@asyncio.coroutine
|
||||
def delete(self):
|
||||
"""
|
||||
|
||||
@@ -273,11 +273,6 @@ class Project:
|
||||
yield from compute.post("/projects/{}/close".format(self._id))
|
||||
self._allocated_node_names.clear()
|
||||
|
||||
@asyncio.coroutine
|
||||
def commit(self):
|
||||
for compute in self._project_created_on_compute:
|
||||
yield from compute.post("/projects/{}/commit".format(self._id))
|
||||
|
||||
@asyncio.coroutine
|
||||
def delete(self):
|
||||
yield from self.close()
|
||||
|
||||
@@ -121,23 +121,6 @@ class ProjectHandler:
|
||||
yield from module.instance().project_moved(project)
|
||||
response.json(project)
|
||||
|
||||
@Route.post(
|
||||
r"/projects/{project_id}/commit",
|
||||
description="Write changes on disk",
|
||||
parameters={
|
||||
"project_id": "Project UUID",
|
||||
},
|
||||
status_codes={
|
||||
204: "Changes have been written on disk",
|
||||
404: "The project doesn't exist"
|
||||
})
|
||||
def commit(request, response):
|
||||
|
||||
pm = ProjectManager.instance()
|
||||
project = pm.get_project(request.match_info["project_id"])
|
||||
yield from project.commit()
|
||||
response.set_status(204)
|
||||
|
||||
@Route.post(
|
||||
r"/projects/{project_id}/close",
|
||||
description="Close a project",
|
||||
|
||||
@@ -76,23 +76,6 @@ class ProjectHandler:
|
||||
project = controller.get_project(request.match_info["project_id"])
|
||||
response.json(project)
|
||||
|
||||
@Route.post(
|
||||
r"/projects/{project_id}/commit",
|
||||
description="Write changes on disk",
|
||||
parameters={
|
||||
"project_id": "Project UUID",
|
||||
},
|
||||
status_codes={
|
||||
204: "Changes have been written on disk",
|
||||
404: "The project doesn't exist"
|
||||
})
|
||||
def commit(request, response):
|
||||
|
||||
controller = Controller.instance()
|
||||
project = controller.get_project(request.match_info["project_id"])
|
||||
yield from project.commit()
|
||||
response.set_status(204)
|
||||
|
||||
@Route.post(
|
||||
r"/projects/{project_id}/close",
|
||||
description="Close a project",
|
||||
|
||||
Reference in new issue
Block a user