From e5e2fb866c301474f8e25bd738318cfe1c7882a0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:00:32 +0200 Subject: [PATCH] ++fixes Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 2 +- lib/cdist/config_install.py | 17 +++++++++-------- lib/cdist/context.py | 17 +++++------------ 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index c5f4b4ef..71ce14ed 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -42,7 +42,7 @@ def config(args): os.environ['__remote_copy'] = "scp -o User=root -q" for host in args.host: - c = Config(host, initial_manifest=args.manifest, base_dir=args.cdist_home, debug=args.debug) + c = Config(host, initial_manifest=args.manifest, base_path=args.cdist_home, debug=args.debug) if args.parallel: log.debug("Creating child process for %s", host) process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3f1c467e..c1cdf328 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -70,7 +70,7 @@ class ConfigInstall: log.debug("%s: Running %s", cdist_object.name, manifest) if os.path.exists(manifest_path): env = { "__object" : os.path.join(self.context.object_base_path, - cdist_object.path) + cdist_object.path), "__object_id": cdist_object.object_id, "__object_fq": cdist_object.name, "__type": os.path.join(self.context.type_base_path, @@ -213,16 +213,17 @@ class ConfigInstall: """Run global explorers""" log.info("Running global explorers") - src = cdist.core.GlobalExplorer.base_path - dst = cdist.core.GlobalExplorer.remote_base_path + src_path = cdist.context.global_explorer_path + dst_path = cdist.context.global_explorer_out_path + remote_dst_path = cdist.context.remote_global_explorer_path - self.context.transfer_path(src, dst) + self.context.transfer_path(src_path, remote_dst_path) - for explorer in cdist.core.GlobalExplorer.list_explorers(): - output_fd = open(explorer.out_path, mode='w') + for explorer in os.listdir(src_path): + output_fd = open(os.path.join(dst_path, explorer), mode='w') cmd = [] - cmd.append("__explorer=" + cdist.core.GlobalExplorer.remote_base_path) - cmd.append(explorer.remote_path) + cmd.append("__explorer=" + remote_dst_path) + cmd.append(os.path.join(src_path, explorer)) cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) output_fd.close() diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 4cfc6c59..f1f031a8 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -47,11 +47,10 @@ class Context: if base_path: self.base_path = base_path else: - self.base_path = - os.path.abspath( - os.path.join(os.path.dirname(__file__), - os.pardir, - os.pardir)) + self.base_path = os.path.abspath( + os.path.join(os.path.dirname(__file__), + os.pardir, + os.pardir)) # Local input directories @@ -70,7 +69,7 @@ class Context: # Local output directories if out_path: - self.out_path = out_path: + self.out_path = out_path else: self.out_path = os.path.join(tempfile.mkdtemp(), "out") @@ -92,7 +91,6 @@ class Context: # Create directories self.__init_out_paths() self.__init_remote_paths() - self.__init_env() def cleanup(self): # Do not use in __del__: @@ -106,11 +104,6 @@ class Context: shutil.rmtree(self.cache_path) shutil.move(self.base_path, self.cache_path) - #def __init_env(self): - # """Setup environment""" - # os.environ['__cdist_out_path'] = self.out_path - # os.environ['__cdist_base_path'] = self.base_path - def __init_out_paths(self): """Initialise output directory structure"""