Allow suppression of warnings from DriverManager

Some projects (e.g. Neutron) using the DriverManager with
another fallback mechanism when the alias doesn't exist don't
want the "Could not load warning" messages in the logs.

This patch allows the warn_on_missing_entrypoint kwarg to be
passed to DriverManager which passes it up to its parent
NamedExtensionManager.

Change-Id: Ia6f5f749fc2f73ca6091fa6d58506fddb058902a
This commit is contained in:
Kevin Benton 2017-01-09 10:22:42 -08:00
parent 57e4c9cde4
commit 04f5e154e5
1 changed files with 4 additions and 1 deletions

View File

@ -40,12 +40,14 @@ class DriverManager(NamedExtensionManager):
:param verify_requirements: Use setuptools to enforce the
dependencies of the plugin(s) being loaded. Defaults to False.
:type verify_requirements: bool
:type warn_on_missing_entrypoint: bool
"""
def __init__(self, namespace, name,
invoke_on_load=False, invoke_args=(), invoke_kwds={},
on_load_failure_callback=None,
verify_requirements=False):
verify_requirements=False,
warn_on_missing_entrypoint=True):
on_load_failure_callback = on_load_failure_callback \
or self._default_on_load_failure
super(DriverManager, self).__init__(
@ -56,6 +58,7 @@ class DriverManager(NamedExtensionManager):
invoke_kwds=invoke_kwds,
on_load_failure_callback=on_load_failure_callback,
verify_requirements=verify_requirements,
warn_on_missing_entrypoint=warn_on_missing_entrypoint
)
@staticmethod