begin to implement -C --cache-dir

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2013-08-19 00:03:57 +02:00
parent b80b548f14
commit 83c981f477
2 changed files with 8 additions and 2 deletions

View File

@ -40,11 +40,13 @@ class Context(object):
initial_manifest=False,
add_conf_dirs=None,
exec_path=sys.argv[0],
debug=False):
debug=False,
cache_dir=None):
self.debug = debug
self.target_host = target_host
self.exec_path = exec_path
self.cache_dir = cache_dir
# Context logging
self.log = logging.getLogger(self.target_host)
@ -59,7 +61,9 @@ class Context(object):
self.temp_dir = tempfile.mkdtemp()
self.out_path = os.path.join(self.temp_dir, "out")
self.local = local.Local(self.target_host, self.out_path, self.exec_path, add_conf_dirs=add_conf_dirs)
self.local = local.Local(self.target_host, self.out_path,
self.exec_path, add_conf_dirs=add_conf_dirs,
cache_dir=self.cache_dir)
self.initial_manifest = (initial_manifest or
os.path.join(self.local.manifest_path, "init"))

View File

@ -60,6 +60,8 @@ def commandline():
parser['configinstall'].add_argument('-c', '--conf-dir',
help='Add configuration directory (can be repeated, last one wins)',
action='append')
parser['configinstall'].add_argument('-C', '--cache-dir',
help='Directory to save cache in (usually derived from target host name)')
parser['configinstall'].add_argument('-i', '--initial-manifest',
help='Path to a cdist manifest or \'-\' to read from stdin.',
dest='manifest', required=False)