Drop the commit system

Ref https://github.com/GNS3/gns3-gui/issues/1243
This commit is contained in:
Julien Duponchelle committed 2016-06-14 10:16:33 +02:00
1 parent 52f852bc6d
commit 3255be0ae2
9 files changed
+2 -150

No files matched your search

+1 -11
View File
@@ -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
-17
View File
@@ -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):
"""
+1 -22
View File
@@ -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):
"""