Browse Source

Don't ignore failure to load extensions

When an extension fails to load a message will be logged along with
the exception raised by the extension. The exception will be
re-raised.

Change-Id: Ic8e8931a34f59102dbcd1f5c5dc48d562cabedff
Closes-bug: #1555005
changes/67/304867/4
Ryan Moe 6 years ago
parent
commit
b20d67712e
  1. 7
      nailgun/nailgun/extensions/manager.py

7
nailgun/nailgun/extensions/manager.py

@ -20,10 +20,16 @@ from stevedore.extension import ExtensionManager
from nailgun import errors
from nailgun.extensions import consts
from nailgun.logger import logger
_EXTENSION_MANAGER = None
def on_load_failure(manager, endpoint, exc):
logger.exception("Failed to load %s extension", endpoint.name)
raise
def get_all_extensions():
"""Retrieves all available extensions for Nailgun
@ -36,6 +42,7 @@ def get_all_extensions():
if _EXTENSION_MANAGER is None:
_EXTENSION_MANAGER = ExtensionManager(
on_load_failure_callback=on_load_failure,
namespace=consts.EXTENSIONS_NAMESPACE)
return (ext.plugin for ext in _EXTENSION_MANAGER.extensions)

Loading…
Cancel
Save