cleanups/fixes

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-10-07 15:49:25 +02:00
parent f8853467f3
commit c1e7731992
2 changed files with 16 additions and 25 deletions

View file

@ -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")
self.context.remove_remote_path(self.context.remote_base_path)
self.context.remote_mkdir(self.context.remote_base_path)
self.link_emulator()
####FIXED ######################################################################
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,
src = os.path.join(self.context.object_base_path,
cdist_object.parameter_path)
remote_path =
os.path.join(self.context.remote_object_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)

View file

@ -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)