Stop Dynamips hypervisors used by devices before the project is closed.

This is to avoid locked files by hypervisors preventing temporary project working directories to be deleted.
This commit is contained in:
grossmj committed 2015-03-01 19:20:33 -07:00
1 parent 3ef529fb0e
commit c48ca212bd
3 files changed
+23 -3

No files matched your search

+11 -3
View File
@@ -136,9 +136,9 @@ class Dynamips(BaseManager):
continue
@asyncio.coroutine
def project_closed(self, project):
def project_closing(self, project):
"""
Called when a project is closed.
Called when a project is about to be closed.
:param project: Project instance
"""
@@ -157,7 +157,15 @@ class Dynamips(BaseManager):
except Exception as e:
log.error("Could not delete device {}".format(e), exc_info=1)
# delete useless files
@asyncio.coroutine
def project_closed(self, project):
"""
Called when a project is closed.
:param project: Project instance
"""
# delete useless Dynamips files
project_dir = project.module_working_directory(self.module_name.lower())
files = glob.glob(os.path.join(project_dir, "*.ghost"))
files += glob.glob(os.path.join(project_dir, "*_lock"))