summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sherwood <paul.sherwood@codethink.co.uk>2014-06-07 08:21:17 +0000
committerRichard Ipsum <richardipsum@fastmail.co.uk>2014-06-07 16:48:42 +0000
commite88455c62914ed70b439b37c2ba64a446cb295c3 (patch)
treec52049944efada1a0a416faddb4ba616b9b42123
parente0d7338382ce69156de0514525ab3935971fcf85 (diff)
downloadmorph-e88455c62914ed70b439b37c2ba64a446cb295c3.tar.gz
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.
-rw-r--r--morphlib/plugins/gc_plugin.py7
1 files changed, 6 insertions, 1 deletions
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',