summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-06-13 09:34:43 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-06-13 09:34:43 +0000
commitc1164a88d9b07d165ff5eed6c8026be8241beb64 (patch)
tree6b36f8ac635e7978584c9a2a468a5f3ae6b1f3f3
parentb6f37209fc277883c983b1602d3a98b4045f6dee (diff)
downloadmorph-c1164a88d9b07d165ff5eed6c8026be8241beb64.tar.gz
Don't delete subdirectories of tempdir in gc plugin
There is code that assumes these exist in at least one place: StagingArea.abort(). That code should be fixed, but we should also stop deleting them every time we run 'morph gc'.
-rw-r--r--morphlib/plugins/gc_plugin.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/morphlib/plugins/gc_plugin.py b/morphlib/plugins/gc_plugin.py
index 43de173e..68f386eb 100644
--- a/morphlib/plugins/gc_plugin.py
+++ b/morphlib/plugins/gc_plugin.py
@@ -79,6 +79,8 @@ class GCPlugin(cliapp.Plugin):
self.cleanup_cachedir(cachedir, cachedir_min_space)
def cleanup_tempdir(self, temp_path, min_space):
+ # The subdirectories in tempdir are created at Morph startup time. Code
+ # assumes that they exist in various places.
self.app.status(msg='Cleaning up temp dir %(temp_path)s',
temp_path=temp_path, chatty=True)
for subdir in ('deployments', 'failed', 'chunks'):
@@ -93,6 +95,7 @@ class GCPlugin(cliapp.Plugin):
path = os.path.join(temp_path, subdir)
if os.path.exists(path):
shutil.rmtree(path)
+ os.mkdir(path)
def calculate_delete_range(self):
now = time.time()