From c1164a88d9b07d165ff5eed6c8026be8241beb64 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Fri, 13 Jun 2014 09:34:43 +0000 Subject: 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'. --- morphlib/plugins/gc_plugin.py | 3 +++ 1 file changed, 3 insertions(+) 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() -- cgit v1.2.1