Save configs when project is committed.

This commit is contained in:
grossmj 2015-03-21 14:52:17 -06:00
parent 628dfef0d3
commit 2d6d153262
3 changed files with 25 additions and 0 deletions

View File

@ -282,6 +282,16 @@ 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_vm(self, vm_id):
"""

View File

@ -199,6 +199,19 @@ 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 vm in self._vms.values():
if vm.project.id == project.id:
yield from vm.save_configs()
@property
def dynamips_path(self):
"""

View File

@ -324,6 +324,8 @@ class Project:
vm = self._vms_to_destroy.pop()
yield from vm.delete()
self.remove_vm(vm)
for module in self.modules():
yield from module.instance().project_committed(self)
@asyncio.coroutine
def delete(self):