move explorer out dir creation into Explorer class

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-10-11 17:05:35 +02:00
parent d95d195b40
commit b7824c3ead
2 changed files with 8 additions and 5 deletions

View file

@ -73,7 +73,6 @@ class ConfigInstall(object):
# FIXME: raise more beautiful exception / Steven: handle exception # FIXME: raise more beautiful exception / Steven: handle exception
os.mkdir(self.context.out_path) os.mkdir(self.context.out_path)
os.mkdir(self.global_explorer_out_path)
os.mkdir(self.context.bin_path) os.mkdir(self.context.bin_path)
# FIXME: remove this function, only expose ENV # FIXME: remove this function, only expose ENV
@ -93,8 +92,7 @@ class ConfigInstall(object):
def object_prepare(self, cdist_object): def object_prepare(self, cdist_object):
"""Prepare object: Run type explorer + manifest""" """Prepare object: Run type explorer + manifest"""
log.debug("Preparing object: " + cdist_object.name) log.debug("Preparing object: " + cdist_object.name)
cdist_object.explorers = cdist_object.explorers = self.explorer.run_type_explorer(cdist_object)
self.explorer.run_type_explorer(cdist_object)
self.manifest.run_type_manifest(cdist_object) self.manifest.run_type_manifest(cdist_object)
cdist_object.prepared = True cdist_object.prepared = True

View file

@ -22,16 +22,17 @@
import io import io
import logging import logging
#import os import os
#import stat #import stat
#import shutil #import shutil
#import sys #import sys
#import tempfile #import tempfile
#import time #import time
# #
#import cdist.core
#import cdist.exec #import cdist.exec
import cdist
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class Explorer: class Explorer:
@ -39,6 +40,10 @@ class Explorer:
def __init__(self, context): def __init__(self, context):
self.context = context self.context = context
try:
os.mkdir(self.context.global_explorer_out_path)
except OSError as e:
raise cdist.Error("Failed to create explorer out path: %s" % e)
def run_type_explorer(self, cdist_object): def run_type_explorer(self, cdist_object):
"""Run type specific explorers for objects""" """Run type specific explorers for objects"""