Merge "Remove loading drivers outside of their expected namespaces"

This commit is contained in:
Jenkins 2017-06-06 00:20:13 +00:00 committed by Gerrit Code Review
commit 011f4bd517
3 changed files with 11 additions and 17 deletions

View File

@ -18,8 +18,6 @@ import time
import types
from oslo_log import log
from oslo_log import versionutils
from oslo_utils import importutils
import six
import stevedore
@ -72,20 +70,9 @@ def load_driver(namespace, driver_name, *args):
invoke_on_load=True,
invoke_args=args)
return driver_manager.driver
except RuntimeError as e:
LOG.debug('Failed to load %r using stevedore: %s', driver_name, e)
# Ignore failure and continue on.
driver = importutils.import_object(driver_name, *args)
msg = (_(
'Direct import of driver %(name)r is deprecated as of Liberty in '
'favor of its entrypoint from %(namespace)r and may be removed in '
'N.') %
{'name': driver_name, 'namespace': namespace})
versionutils.report_deprecated_feature(LOG, msg)
return driver
except stevedore.exception.NoMatches:
msg = (_('Unable to find %(name)r driver in %(namespace)r.'))
raise ImportError(msg, {'name': driver_name, 'namespace': namespace})
class _TraceMeta(type):

View File

@ -762,7 +762,7 @@ class TestTokenProvider(unit.TestCase):
def test_unsupported_token_provider(self):
self.config_fixture.config(group='token',
provider='my.package.MyProvider')
provider='MyProvider')
self.assertRaises(ImportError,
token.provider.Manager)

View File

@ -36,3 +36,10 @@ other:
The ``keystone-manage pki_setup`` was added to aid developer setup by hiding the sometimes cryptic
openssl commands. This is no longer needed since keystone no longer supports PKI tokens and can no
longer serve SSL. This was deprecated in the Mitaka release.
- >
[`blueprint removed-as-of-pike <https://blueprints.launchpad.net/keystone/+spec/removed-as-of-pike>`_]
Direct import of drivers outside of their `keystone` namespace has been
removed. Ex. identity drivers are loaded from the `keystone.identity`
namespace and assignment drivers from the `keystone.assignment` namespace.
Loading drivers outside of their keystone namespaces was deprecated in the
Liberty release.