move save_cache into local

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2013-06-21 16:52:56 +02:00
parent 4758daa037
commit 14a3bf7262
2 changed files with 10 additions and 3 deletions

View File

@ -44,8 +44,7 @@ class ConfigInstall(object):
# Add switch to disable code execution
self.dry_run = False
def cleanup(self):
# FIXME: move to local?
def save_cache(self):
destination = os.path.join(self.context.local.cache_path, self.context.target_host)
self.log.debug("Saving " + self.context.local.out_path + " to " + destination)
if os.path.exists(destination):
@ -67,7 +66,7 @@ class ConfigInstall(object):
self.manifest.run_initial_manifest(self.context.initial_manifest)
self.iterate_until_finished()
self.cleanup()
self.context.local.save_cache()
self.log.info("Finished successful run in %s seconds", time.time() - start_time)

View File

@ -160,6 +160,14 @@ class Local(object):
self._create_conf_path_and_link_conf_dirs()
self._link_types_for_emulator()
def save_cache(self):
destination = os.path.join(self.local.cache_path, self.target_host)
self.log.debug("Saving " + self.out_path + " to " + destination)
if os.path.exists(destination):
shutil.rmtree(destination)
shutil.move(self.out_path, destination)
def _create_context_dirs(self):
self.mkdir(self.out_path)