From 2b0a337584b929546e1515824c3b8ccc991ab7ec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:45:19 +0200 Subject: [PATCH] fix base_dir passing Signed-off-by: Nico Schottelius --- bin/cdist | 1 - lib/cdist/config_install.py | 7 ++++--- lib/cdist/context.py | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index bd6825eb..7d2c035b 100755 --- a/bin/cdist +++ b/bin/cdist @@ -112,7 +112,6 @@ if __name__ == "__main__": import cdist.emulator cdist.emulator.run(sys.argv) else: - import cdist import cdist.banner import cdist.config import cdist.install diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index e8d179e8..407cdcd7 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -37,8 +37,9 @@ class ConfigInstall: """Cdist main class to hold arbitrary data""" def __init__(self, target_host, initial_manifest=False, - exec_path=sys.argv[0], - debug=False): + base_dir=False, + exec_path=sys.argv[0], + debug=False): self.target_host = target_host os.environ['target_host'] = target_host @@ -47,7 +48,7 @@ class ConfigInstall: self.exec_path = exec_path self.context = cdist.context.Context(self.target_host, - initial_manifest=initial_manifest, + initial_manifest=initial_manifest, base_dir=base_dir, debug=debug) def cleanup(self): diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 44f432a8..1615d196 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -33,12 +33,15 @@ import cdist.exec class Context: """Storing context dependent information""" - def __init__(self, target_host, initial_manifest=False, debug=False): + def __init__(self, target_host, initial_manifest=False, base_dir=False, + debug=False): self.target_host = target_host # Base and Temp Base - if "__cdist_base_dir" in os.environ: + if base_dir: + self.base_dir = base_dir + elif "__cdist_base_dir" in os.environ: self.base_dir = os.environ['__cdist_base_dir'] else: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))