use context in explorer

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
remotes/origin/feature_files_export
Nico Schottelius 13 years ago
parent ba43212681
commit 588731661e
  1. 19
      lib/cdist/config_install.py
  2. 19
      lib/cdist/explorer.py

@ -31,6 +31,8 @@ import time
import cdist.core
import cdist.context
import cdist.exec
import cdist.explorer
#import cdist.manifest
class ConfigInstall(object):
"""Cdist main class to hold arbitrary data"""
@ -40,12 +42,11 @@ class ConfigInstall(object):
self.context = context
self.exec_wrapper = cdist.exec.Wrapper(
targe_host = self.target_host,
remote_exec=os.environ['__remote_exec'].split(),
remote_copy=os.environ['__remote_copy'].split()
)
target_host = self.context.target_host,
remote_exec=self.context.remote_exec,
remote_copy=self.context.remote_copy)
self.explorer = cdist.explorer.Explorer()
self.explorer = cdist.explorer.Explorer(self.context)
self.manifest = cdist.manifest.Mamifest()
self.log = logging.getLogger(self.context.target_host)
@ -79,7 +80,7 @@ class ConfigInstall(object):
# explicitly!
def __init_env(self):
"""Environment usable for other stuff"""
os.environ['__target_host'] = self.target_host
os.environ['__target_host'] = self.context.target_host
if self.debug:
os.environ['__debug'] = "yes"
@ -114,7 +115,7 @@ class ConfigInstall(object):
# Setup env Variable:
#
env = os.environ.copy()
env['__target_host'] = self.target_host
env['__target_host'] = self.context.target_host
env['__global'] = self.out_path
env["__object"] = os.path.join(self.object_base_path, cdist_object.path)
env["__object_id"] = cdist_object.object_id
@ -178,7 +179,7 @@ class ConfigInstall(object):
def deploy_to(self):
"""Mimic the old deploy to: Deploy to one host"""
log.info("Deploying to " + self.target_host)
log.info("Deploying to " + self.context.target_host)
self.stage_prepare()
self.stage_run()
@ -188,7 +189,7 @@ class ConfigInstall(object):
self.deploy_to()
self.cleanup()
log.info("Finished run of %s in %s seconds",
self.target_host, time.time() - start_time)
self.context.target_host, time.time() - start_time)
def stage_prepare(self):
"""Do everything for a deploy, minus the actual code stage"""

@ -37,21 +37,10 @@ log = logging.getLogger(__name__)
class Explorer:
"""Execute explorers"""
def __init__(self,
object_base_path,
remote_global_explorer_path,
remote_type_path,
remote_object_path,
type_path,
exec_hint):
self.object_base_path = object_base_path
self.remote_global_explorer_path = remote_global_explorer_path
self.remote_type_path = remote_type_path
self.remote_object_path = remote_object_path
self.exec_hint = exec_hint
def run_type_explorer(self, cdist_object)
def __init__(self, context):
self.context = context
def run_type_explorer(self, cdist_object):
"""Run type specific explorers for objects"""
cdist_type = cdist_object.type

Loading…
Cancel
Save