diff --git a/murano/dsl/exceptions.py b/murano/dsl/exceptions.py index c8c4039c..c923ff84 100644 --- a/murano/dsl/exceptions.py +++ b/murano/dsl/exceptions.py @@ -44,8 +44,11 @@ class NoMethodFound(Exception): class NoClassFound(Exception): - def __init__(self, name): - super(NoClassFound, self).__init__('Class "%s" is not found' % name) + def __init__(self, name, packages=[]): + packages = ', '.join("{0}/{1}".format(p.name, p.version) + for p in packages) + super(NoClassFound, self).__init__( + 'Class "{0}" is not found in {1}'.format(name, packages)) class NoPackageFound(Exception): diff --git a/murano/dsl/murano_package.py b/murano/dsl/murano_package.py index b2abb8b6..3f3e66f7 100644 --- a/murano/dsl/murano_package.py +++ b/murano/dsl/murano_package.py @@ -143,8 +143,8 @@ class MuranoPackage(dsl_types.MuranoPackage): result = self._classes.get(name) if result: return result - if search_requirements: + pkgs_for_search = [] for package_name, version_spec in self._requirements.iteritems(): if package_name == self.name: continue @@ -153,8 +153,11 @@ class MuranoPackage(dsl_types.MuranoPackage): try: return referenced_package.find_class(name, False) except exceptions.NoClassFound: + pkgs_for_search.append(referenced_package) continue - raise exceptions.NoClassFound(name) + raise exceptions.NoClassFound(name, packages=pkgs_for_search) + + raise exceptions.NoClassFound(name, packages=[self]) @property def context(self):