Fix missing dirs cleanup.

This commit is contained in:
Darko Poljak 2017-09-10 23:08:21 +02:00
parent 519eb60664
commit 1ae5b1732e
3 changed files with 5 additions and 1 deletions

View file

@ -260,6 +260,10 @@ class Config(object):
if len(failed_hosts) > 0: if len(failed_hosts) > 0:
raise cdist.Error("Failed to configure the following hosts: " + raise cdist.Error("Failed to configure the following hosts: " +
" ".join(failed_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 @classmethod
def _resolve_ssh_control_path(cls): def _resolve_ssh_control_path(cls):

View file

@ -79,7 +79,6 @@ class Local(object):
self._init_log() self._init_log()
self._init_permissions() self._init_permissions()
self.mkdir(self.base_path) self.mkdir(self.base_path)
# FIXME: create dir that does not require moving later
self._init_cache_dir(None) self._init_cache_dir(None)
self._init_paths() self._init_paths()
self._init_object_marker() self._init_object_marker()

View file

@ -49,6 +49,7 @@ class RemoteTestCase(test.CdistTestCase):
def tearDown(self): def tearDown(self):
shutil.rmtree(self.temp_dir) shutil.rmtree(self.temp_dir)
shutil.rmtree(self.base_path)
# test api # test api