From a8c41bfe4469158202b38cd7990b6622a5cd27db Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Thu, 2 Nov 2017 19:56:27 +0100 Subject: [PATCH] Change warning message for invalid type. --- cdist/core/cdist_type.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cdist/core/cdist_type.py b/cdist/core/cdist_type.py index 42533a4d..beb459b3 100644 --- a/cdist/core/cdist_type.py +++ b/cdist/core/cdist_type.py @@ -31,11 +31,11 @@ class InvalidTypeError(cdist.Error): self.name = name self.type_path = type_path self.type_absolute_path = type_absolute_path + self.source_path = os.path.realpath(self.type_absolute_path) def __str__(self): return "Invalid type '%s' at '%s' defined at '%s'" % ( - self.type_path, self.type_absolute_path, - os.path.realpath(self.type_absolute_path)) + self.type_path, self.type_absolute_path, self.source_path) class CdistType(object): @@ -81,10 +81,11 @@ class CdistType(object): yield cls(base_path, name) except InvalidTypeError as e: # ignore invalid type, log warning and continue - cls.log.warning(e) + msg = "Ignoring invalid type '%s' at '%s' defined at '%s'" % ( + e.type_path, e.type_absolute_path, e.source_path) + cls.log.warning(msg) # remove invalid from runtime conf dir - absolute_path = os.path.join(base_path, name) - os.remove(absolute_path) + os.remove(e.type_absolute_path) @classmethod def list_type_names(cls, base_path):