From 56b6c95ed4811b64dc869da277c89febe9a1e029 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 30 Nov 2012 13:48:34 +0100 Subject: [PATCH] implement conf-dir from CDIST_PATH environment variable Signed-off-by: Steven Armstrong --- cdist/context.py | 2 +- cdist/exec/local.py | 9 ++++++++- cdist/test/exec/local.py | 19 +++++++++++++++++++ docs/man/man1/cdist.text | 13 +++++++++---- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/cdist/context.py b/cdist/context.py index 767b17a8..e0391be8 100644 --- a/cdist/context.py +++ b/cdist/context.py @@ -38,7 +38,7 @@ class Context(object): remote_copy, remote_exec, initial_manifest=False, - add_conf_dirs=[], + add_conf_dirs=None, exec_path=sys.argv[0], debug=False): diff --git a/cdist/exec/local.py b/cdist/exec/local.py index 7ef11458..7f640411 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -23,6 +23,7 @@ import io import os import sys +import re import subprocess import shutil import logging @@ -37,7 +38,7 @@ class Local(object): Directly accessing the local side from python code is a bug. """ - def __init__(self, target_host, out_path, exec_path, add_conf_dirs=[], cache_dir=None): + def __init__(self, target_host, out_path, exec_path, add_conf_dirs=None, cache_dir=None): self.target_host = target_host self.out_path = out_path @@ -92,6 +93,12 @@ class Local(object): if self.home_dir: self.conf_dirs.append(self.home_dir) + # Add directories defined in the CDIST_PATH environment variable + if 'CDIST_PATH' in os.environ: + cdist_path_dirs = re.split(r'(?