From a7fe8b4ed2da2c9b2dbf3bb7e5813ea8e58142cb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Aug 2013 00:36:25 +0200 Subject: [PATCH] port context -> remote Signed-off-by: Nico Schottelius --- cdist/context.py | 20 -------------------- cdist/exec/remote.py | 7 +++++++ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/cdist/context.py b/cdist/context.py index 4115c0d6..9e20f969 100644 --- a/cdist/context.py +++ b/cdist/context.py @@ -37,11 +37,6 @@ class Context(object): 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) self.log.addFilter(self) @@ -49,21 +44,6 @@ class Context(object): self.initial_manifest = (initial_manifest or os.path.join(self.local.manifest_path, "init")) - self._init_remote(remote_copy, remote_exec) - - # Remote stuff - def _init_remote(self, remote_copy, remote_exec): - - self.remote_base_path = os.environ.get('__cdist_remote_out_dir', "/var/lib/cdist") - self.remote_copy = remote_copy - self.remote_exec = remote_exec - - os.environ['__remote_copy'] = self.remote_copy - os.environ['__remote_exec'] = self.remote_exec - - self.remote = remote.Remote(self.target_host, self.remote_base_path, - self.remote_exec, self.remote_copy) - def filter(self, record): """Add hostname to logs via logging Filter""" diff --git a/cdist/exec/remote.py b/cdist/exec/remote.py index 4e336e79..6d89324b 100644 --- a/cdist/exec/remote.py +++ b/cdist/exec/remote.py @@ -57,6 +57,13 @@ class Remote(object): self.log = logging.getLogger(self.target_host) + self._init_env() + + def _init_env(self): + os.environ['__remote_copy'] = self.remote_copy + os.environ['__remote_exec'] = self.remote_exec + + def create_files_dirs(self): self.rmdir(self.base_path) self.mkdir(self.base_path)