From b7824c3ead3dfcab89ab6105aaa35b85f94c358c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 17:05:35 +0200 Subject: [PATCH] move explorer out dir creation into Explorer class Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 4 +--- lib/cdist/explorer.py | 9 +++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index f9aeaf19..3c809331 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -73,7 +73,6 @@ class ConfigInstall(object): # FIXME: raise more beautiful exception / Steven: handle exception os.mkdir(self.context.out_path) - os.mkdir(self.global_explorer_out_path) os.mkdir(self.context.bin_path) # FIXME: remove this function, only expose ENV @@ -93,8 +92,7 @@ class ConfigInstall(object): def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" log.debug("Preparing object: " + cdist_object.name) - cdist_object.explorers = - self.explorer.run_type_explorer(cdist_object) + cdist_object.explorers = self.explorer.run_type_explorer(cdist_object) self.manifest.run_type_manifest(cdist_object) cdist_object.prepared = True diff --git a/lib/cdist/explorer.py b/lib/cdist/explorer.py index b0db60bc..9030e506 100644 --- a/lib/cdist/explorer.py +++ b/lib/cdist/explorer.py @@ -22,16 +22,17 @@ import io import logging -#import os +import os #import stat #import shutil #import sys #import tempfile #import time # -#import cdist.core #import cdist.exec +import cdist + log = logging.getLogger(__name__) class Explorer: @@ -39,6 +40,10 @@ class Explorer: def __init__(self, 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): """Run type specific explorers for objects"""