NoSuchTypeError -> InvalidTypeError
This commit is contained in:
parent
5e087fd280
commit
e6c5563a16
6 changed files with 15 additions and 8 deletions
|
|
@ -21,7 +21,7 @@
|
|||
#
|
||||
|
||||
from cdist.core.cdist_type import CdistType
|
||||
from cdist.core.cdist_type import NoSuchTypeError
|
||||
from cdist.core.cdist_type import NoSuchTypeError, InvalidTypeError
|
||||
from cdist.core.cdist_object import CdistObject
|
||||
from cdist.core.cdist_object import IllegalObjectIdError
|
||||
from cdist.core.explorer import Explorer
|
||||
|
|
|
|||
|
|
@ -32,10 +32,17 @@ class NoSuchTypeError(cdist.Error):
|
|||
self.type_absolute_path = type_absolute_path
|
||||
|
||||
def __str__(self):
|
||||
return "Type '%s' does not exist at %s" % (
|
||||
return "Type '%s' does not exist at '%s'" % (
|
||||
self.type_path, self.type_absolute_path)
|
||||
|
||||
|
||||
class InvalidTypeError(NoSuchTypeError):
|
||||
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))
|
||||
|
||||
|
||||
class CdistType(object):
|
||||
"""Represents a cdist type.
|
||||
|
||||
|
|
@ -51,7 +58,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.name, self.path, self.absolute_path)
|
||||
raise InvalidTypeError(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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue