From 6429d6f5a47b921400b959ed3a09a6061582680a Mon Sep 17 00:00:00 2001 From: Boden R Date: Mon, 6 Mar 2017 09:25:49 -0700 Subject: [PATCH] Use warn_on_missing_entrypoint from stevedore 1.20.0 As noted in the comment being removed as part of this patch, commit [1] updated stevedore to accept a warn_on_missing_entrypoint kwarg to toggle warning messages. This patch updates our code to use it and removes the _SilentDriverManager that's no longer needed now. [1] Ia6f5f749fc2f73ca6091fa6d58506fddb058902a Change-Id: I177d361d07bc19af9405c84f3f779c738b1bdcef --- neutron/common/utils.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/neutron/common/utils.py b/neutron/common/utils.py index 20819564bd4..e84ae3b63a1 100644 --- a/neutron/common/utils.py +++ b/neutron/common/utils.py @@ -255,24 +255,6 @@ class DelayedStringRenderer(object): return str(self.function(*self.args, **self.kwargs)) -class _SilentDriverManager(driver.DriverManager): - """The lamest of hacks to allow us to pass a kwarg to DriverManager parent. - - DriverManager doesn't accept the warn_on_missing_entrypoint param - to pass to its parent on __init__ so we mirror the __init__ here and bypass - the one in DriverManager in order to silence the warnings. - TODO(kevinbenton): remove once Ia6f5f749fc2f73ca6091fa6d58506fddb058902a - is released or we stop supporting loading by class path. - """ - def __init__(self, namespace, name): - p = super(driver.DriverManager, self) # pylint: disable=bad-super-call - p.__init__( - namespace=namespace, names=[name], - on_load_failure_callback=self._default_on_load_failure, - warn_on_missing_entrypoint=False - ) - - def load_class_by_alias_or_classname(namespace, name): """Load class using stevedore alias or the class name :param namespace: namespace where the alias is defined @@ -286,7 +268,8 @@ def load_class_by_alias_or_classname(namespace, name): raise ImportError(_("Class not found.")) try: # Try to resolve class by alias - mgr = _SilentDriverManager(namespace, name) + mgr = driver.DriverManager( + namespace, name, warn_on_missing_entrypoint=False) class_to_load = mgr.driver except RuntimeError: e1_info = sys.exc_info()