forked from ungleich-public/cdist
port context -> remote
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
parent
f79727559a
commit
a7fe8b4ed2
2 changed files with 7 additions and 20 deletions
|
@ -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"""
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue