fix base_dir passing

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-10-07 13:45:19 +02:00
parent 1138d8b439
commit 2b0a337584
3 changed files with 9 additions and 6 deletions

View file

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

View file

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

View file

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