From c1e773199251f79db92f5083ef736b3835056ab7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:49:25 +0200 Subject: [PATCH] cleanups/fixes Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 33 +++++++++------------------------ lib/cdist/context.py | 8 +++++++- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 734f7280..3f1c467e 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -48,15 +48,13 @@ class ConfigInstall: self.exec_path = exec_path self.context = cdist.context.Context(self.target_host, - initial_manifest=initial_manifest, base_path=base_path, + initial_manifest=initial_manifest, + base_path=base_path, debug=debug) - + def cleanup(self): self.path.cleanup() - def __init_env(self): - """Setup environment""" - def run_initial_manifest(self): """Run the initial manifest""" log.info("Running initial manifest %s", self.context.initial_manifest) @@ -248,22 +246,15 @@ class ConfigInstall: self.deploy_to() self.cleanup() - def init_deploy(self): - """Ensure the base directories are cleaned up""" - log.debug("Creating clean directory structure") +####FIXED ###################################################################### - self.context.remove_remote_path(self.context.remote_base_path) - self.context.remote_mkdir(self.context.remote_base_path) - self.link_emulator() - def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" - self.init_deploy() + self.link_emulator() self.run_global_explorers() self.run_initial_manifest() log.info("Running object manifests and type explorers") - log.debug("Searching for objects in " + cdist.core.Object.base_path()) # Continue process until no new objects are created anymore @@ -281,22 +272,16 @@ class ConfigInstall: cdist_object.prepared = True new_objects_created = True - # FIXME Move into configinstall def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" - local_path = - os.path.join(self.context.object_base_path, - cdist_object.parameter_path) - remote_path = - os.path.join(self.context.remote_object_path, - cdist_object.parameter_path) + src = os.path.join(self.context.object_base_path, + cdist_object.parameter_path) + dst = os.path.join(self.context.remote_object_path, + cdist_object.parameter_path) # Synchronise parameter dir afterwards self.transfer_path(local_path, remote_path) - -####FIXED ###################################################################### - def transfer_global_explorers(self): """Transfer the global explorers""" self.remote_mkdir(self.context.remote_global_explorer_path) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index af37199e..4cfc6c59 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -91,7 +91,7 @@ class Context: # Create directories self.__init_out_paths() - + self.__init_remote_paths() self.__init_env() def cleanup(self): @@ -122,6 +122,12 @@ class Context: os.mkdir(self.global_explorer_out_path) os.mkdir(self.bin_path) + def __init_remote_paths(self): + """Initialise remote directory structure""" + + self.remove_remote_path(self.remote_base_path) + self.remote_mkdir(self.remote_base_path) + def remote_mkdir(self, directory): """Create directory on remote side""" cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True)