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 import cdist.emulator
cdist.emulator.run(sys.argv) cdist.emulator.run(sys.argv)
else: else:
import cdist
import cdist.banner import cdist.banner
import cdist.config import cdist.config
import cdist.install import cdist.install

View file

@ -37,6 +37,7 @@ class ConfigInstall:
"""Cdist main class to hold arbitrary data""" """Cdist main class to hold arbitrary data"""
def __init__(self, target_host, initial_manifest=False, def __init__(self, target_host, initial_manifest=False,
base_dir=False,
exec_path=sys.argv[0], exec_path=sys.argv[0],
debug=False): debug=False):
@ -47,7 +48,7 @@ class ConfigInstall:
self.exec_path = exec_path self.exec_path = exec_path
self.context = cdist.context.Context(self.target_host, self.context = cdist.context.Context(self.target_host,
initial_manifest=initial_manifest, initial_manifest=initial_manifest, base_dir=base_dir,
debug=debug) debug=debug)
def cleanup(self): def cleanup(self):

View file

@ -33,12 +33,15 @@ import cdist.exec
class Context: class Context:
"""Storing context dependent information""" """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 self.target_host = target_host
# Base and Temp Base # 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'] self.base_dir = os.environ['__cdist_base_dir']
else: else:
self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))