From 1ae5b1732edbc63d449c61c889715e2f40b6518a Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Sun, 10 Sep 2017 23:08:21 +0200 Subject: [PATCH] Fix missing dirs cleanup. --- cdist/config.py | 4 ++++ cdist/exec/local.py | 1 - cdist/test/exec/remote.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cdist/config.py b/cdist/config.py index e33a6027..ed69e3e4 100644 --- a/cdist/config.py +++ b/cdist/config.py @@ -260,6 +260,10 @@ class Config(object): if len(failed_hosts) > 0: raise cdist.Error("Failed to configure the following hosts: " + " ".join(failed_hosts)) + elif not args.out_path: + # If tmp out path created then remove it, but only if no failed + # hosts. + shutil.rmtree(base_root_path) @classmethod def _resolve_ssh_control_path(cls): diff --git a/cdist/exec/local.py b/cdist/exec/local.py index 468deb4a..9f37bde2 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -79,7 +79,6 @@ class Local(object): self._init_log() self._init_permissions() self.mkdir(self.base_path) - # FIXME: create dir that does not require moving later self._init_cache_dir(None) self._init_paths() self._init_object_marker() diff --git a/cdist/test/exec/remote.py b/cdist/test/exec/remote.py index 723d6ddd..5137c59c 100644 --- a/cdist/test/exec/remote.py +++ b/cdist/test/exec/remote.py @@ -49,6 +49,7 @@ class RemoteTestCase(test.CdistTestCase): def tearDown(self): shutil.rmtree(self.temp_dir) + shutil.rmtree(self.base_path) # test api