From 73338c330b81593a4aeade753990c0c61382be17 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 2 Sep 2013 11:30:22 +0200 Subject: [PATCH] record the type name, if there is no such type Signed-off-by: Nico Schottelius --- cdist/core/cdist_type.py | 5 +++-- cdist/emulator.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cdist/core/cdist_type.py b/cdist/core/cdist_type.py index 864970a9..b6ba4f00 100644 --- a/cdist/core/cdist_type.py +++ b/cdist/core/cdist_type.py @@ -25,7 +25,8 @@ import os import cdist class NoSuchTypeError(cdist.Error): - def __init__(self, type_path, type_absolute_path): + def __init__(self, name, type_path, type_absolute_path): + self.name = name self.type_path = type_path self.type_absolute_path = type_absolute_path @@ -48,7 +49,7 @@ class CdistType(object): self.path = self.name self.absolute_path = os.path.join(self.base_path, self.path) if not os.path.isdir(self.absolute_path): - raise NoSuchTypeError(self.path, self.absolute_path) + raise NoSuchTypeError(self.name, self.path, self.absolute_path) self.manifest_path = os.path.join(self.name, "manifest") self.explorer_path = os.path.join(self.name, "explorer") self.gencode_local_path = os.path.join(self.name, "gencode-local") diff --git a/cdist/emulator.py b/cdist/emulator.py index 8d7b0854..f1f4b622 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -177,8 +177,8 @@ class Emulator(object): # Raises an error, if object cannot be created try: cdist_object = self.cdist_object.object_from_name(requirement) - except core.cdist_type.NoSuchTypeError: - self.log.error("%s requires object %s with non-existing type at %s" % (self.cdist_object.name, requirement, self.object_source)) + except core.cdist_type.NoSuchTypeError as e: + self.log.error("%s requires object %s, but type %s does not exist (definded at %s)" % (self.cdist_object.name, requirement, e.name, self.object_source)) raise