From 8a4b8e9b66fa271f1e4b85aa185f110cfeb58d0e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:04:38 +0200 Subject: [PATCH] cleanup run_global_explorers() Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index d0c27e54..c2c4a804 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -57,23 +57,6 @@ class ConfigInstall: def cleanup(self): self.path.cleanup() - def run_global_explorers(self): - """Run global explorers""" - log.info("Running global explorers") - - explorers = cdist.core.GlobalExplorer.list_explorers() - - self.path.transfer_global_explorers() - for explorer in explorers: - output = self.path.global_explorer_output_path(explorer) - output_fd = open(output, mode='w') - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append(self.path.remote_global_explorer_path(explorer)) - - cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) - output_fd.close() - def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" @@ -225,6 +208,25 @@ class ConfigInstall: cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) ### Cleaned / check functions: Round 1 :-) ################################# + def run_global_explorers(self): + """Run global explorers""" + log.info("Running global explorers") + + src = cdist.core.GlobalExplorer.base_dir + dst = cdist.core.GlobalExplorer.remote_base_dir + + self.context.transfer_dir(src, dst) + + for explorer in cdist.core.GlobalExplorer.list_explorers(): + output_fd = open(explorer.out_path, mode='w') + cmd = [] + cmd.append("__explorer=" + cdist.core.GlobalExplorer.remote_base_dir) + cmd.append(explorer.remote_path) + + cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) + output_fd.close() + + def stage_run(self): """The final (and real) step of deployment""" log.info("Generating and executing code")