From e88455c62914ed70b439b37c2ba64a446cb295c3 Mon Sep 17 00:00:00 2001 From: Paul Sherwood Date: Sat, 7 Jun 2014 08:21:17 +0000 Subject: Make morph gc clear out deployments in tmpdir Generally deployment temp dirs are removed by morph during deployment, but in some cases deployment dirs may not be cleared up, for example if morph gets a SIGKILL or something unexpected happens that causes morph to terminate without having a chance to cleanup. --- morphlib/plugins/gc_plugin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/morphlib/plugins/gc_plugin.py b/morphlib/plugins/gc_plugin.py index df736afe..43de173e 100644 --- a/morphlib/plugins/gc_plugin.py +++ b/morphlib/plugins/gc_plugin.py @@ -61,6 +61,11 @@ class GCPlugin(cliapp.Plugin): It also removes any left over temporary chunks and staging areas from failed builds. + In addition we remove failed deployments, generally these are + cleared up by morph during deployment but in some cases they + won't be e.g. if morph gets a SIGKILL or the machine running + morph loses power. + ''' tempdir = self.app.settings['tempdir'] @@ -76,7 +81,7 @@ class GCPlugin(cliapp.Plugin): def cleanup_tempdir(self, temp_path, min_space): self.app.status(msg='Cleaning up temp dir %(temp_path)s', temp_path=temp_path, chatty=True) - for subdir in ('failed', 'chunks'): + for subdir in ('deployments', 'failed', 'chunks'): if morphlib.util.get_bytes_free_in_path(temp_path) >= min_space: self.app.status(msg='Not Removing subdirectory ' '%(subdir)s, enough space already cleared', -- cgit v1.2.1