From 04f5e154e521d593cee1f6a78d5beee8a5db0b13 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Mon, 9 Jan 2017 10:22:42 -0800 Subject: 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 --- stevedore/driver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stevedore/driver.py b/stevedore/driver.py index a4b33b2..167dc67 100644 --- a/stevedore/driver.py +++ b/stevedore/driver.py @@ -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 -- cgit v1.2.1