From 83c981f4778185c3bec1f464066bbaa225e64841 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Aug 2013 00:03:57 +0200 Subject: [PATCH] begin to implement -C --cache-dir Signed-off-by: Nico Schottelius --- cdist/context.py | 8 ++++++-- scripts/cdist | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cdist/context.py b/cdist/context.py index e0391be8..866e43f6 100644 --- a/cdist/context.py +++ b/cdist/context.py @@ -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")) diff --git a/scripts/cdist b/scripts/cdist index 6a61faf4..66735f4b 100755 --- a/scripts/cdist +++ b/scripts/cdist @@ -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)