diff options
Diffstat (limited to 'heat/common/pluginutils.py')
-rw-r--r-- | heat/common/pluginutils.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/heat/common/pluginutils.py b/heat/common/pluginutils.py index c4da0ec06..1fc9618ee 100644 --- a/heat/common/pluginutils.py +++ b/heat/common/pluginutils.py @@ -18,9 +18,17 @@ LOG = logging.getLogger(__name__) def log_fail_msg(manager, entrypoint, exception): - LOG.warning('Encountered exception while loading %(module_name)s: ' - '"%(message)s". Not using %(name)s.', - {'module_name': entrypoint.module, - 'message': getattr(exception, 'message', - str(exception)), - 'name': entrypoint.name}) + # importlib.metadata in Python 3.8 is quite old and the EntryPoint class + # does not have module. This logic is required to workaround AttributeError + # caused by that old implementation. + if hasattr(entrypoint, 'module'): + LOG.warning('Encountered exception while loading %(module_name)s: ' + '"%(message)s". Not using %(name)s.', + {'module_name': entrypoint.module, + 'message': getattr(exception, 'message', str(exception)), + 'name': entrypoint.name}) + else: + LOG.warning('Encountered exception: "%(message)s". ' + 'Not using %(name)s.', + {'message': getattr(exception, 'message', str(exception)), + 'name': entrypoint.name}) |