Change warning message for invalid type.
This commit is contained in:
parent
782e662a13
commit
a8c41bfe44
1 changed files with 6 additions and 5 deletions
|
@ -31,11 +31,11 @@ class InvalidTypeError(cdist.Error):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.type_path = type_path
|
self.type_path = type_path
|
||||||
self.type_absolute_path = type_absolute_path
|
self.type_absolute_path = type_absolute_path
|
||||||
|
self.source_path = os.path.realpath(self.type_absolute_path)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Invalid type '%s' at '%s' defined at '%s'" % (
|
return "Invalid type '%s' at '%s' defined at '%s'" % (
|
||||||
self.type_path, self.type_absolute_path,
|
self.type_path, self.type_absolute_path, self.source_path)
|
||||||
os.path.realpath(self.type_absolute_path))
|
|
||||||
|
|
||||||
|
|
||||||
class CdistType(object):
|
class CdistType(object):
|
||||||
|
@ -81,10 +81,11 @@ class CdistType(object):
|
||||||
yield cls(base_path, name)
|
yield cls(base_path, name)
|
||||||
except InvalidTypeError as e:
|
except InvalidTypeError as e:
|
||||||
# ignore invalid type, log warning and continue
|
# 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
|
# remove invalid from runtime conf dir
|
||||||
absolute_path = os.path.join(base_path, name)
|
os.remove(e.type_absolute_path)
|
||||||
os.remove(absolute_path)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def list_type_names(cls, base_path):
|
def list_type_names(cls, base_path):
|
||||||
|
|
Loading…
Reference in a new issue