From 9540d529d687699fc2da7b03626fd6318965aa9a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:53:24 +0200 Subject: [PATCH] also allow to overwrite remote_base_dir Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 9921dd0f..44b121df 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -25,12 +25,6 @@ import shutil import sys import tempfile -# Hardcoded paths usually not changable -REMOTE_BASE_DIR = "/var/lib/cdist" -REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") -REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") -REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") -REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") log = logging.getLogger(__name__) @@ -74,6 +68,17 @@ class Path: self.object_base_dir = os.path.join(self.out_dir, "object") self.bin_dir = os.path.join(self.out_dir, "bin") + # Remote directories + if "__cdist_remote_base_dir" in os.environ: + self.remote_base_dir = os.environ['__cdist_remote_base_dir'] + else: + self.remote_base_dir = "/var/lib/cdist" + + self.remote_conf_dir = os.path.join(self.remote_base_dir, "conf") + self.remote_object_dir = os.path.join(self.remote_base_dir, "object") + self.remote_type_dir = os.path.join(self.remote_conf_dir, "type") + self.remote_global_explorer_dir = os.path.join(self.remote_conf_dir, "explorer") + # Create directories self.__init_out_dirs()