cinder/cinder/keymgr
Kaitlin Farr 1a27bcab80 Fix key_manager API call
If you pass importutils.import_class a string that is not actually a
reference to a python class, you get an "empty module" error.
Cinder's keymgr.API call used to try to import the castellan backend
directly, but this was not necessary as the castellan key_manager.API
call will return the correct backend based on the api_class or backend
option in the config file. If no api_class or backend option is
specified, castellan key_manager API call will return a barbican backend
by default [1].

Castellan used to require the full class name to specify the backend (i.e.
api_class=castellan.key_manager.barbican_key_manager.BarbicanKeyManager),
so the import_class call in cinder was no issue. Recently castellan
was updated to use stevedore entry points and the config option name was changed
to "backend" [2]. The change in castellan is backwards compatible so that if
you use a full module name instead of the stevedore entry point name, it will
still get the correct backend. However, the cinder code was not updated accordingly,
so any time the shorthand stevedore entry point name for the backend is used
instead of the full module name, the import_class call in cinder will fail.

This change removes the unnecessary import_class call and adds an appropriate
unit test that shows the "empty module" error does not occur anymore.

1. b13187b34d/castellan/key_manager/__init__.py (L25)
2. 8980bf7da5

Closes-Bug: #1724952
Change-Id: I3f95cfe439d65d9cf746d4e3844bc70bc705625e
2017-10-23 17:11:54 -04:00
..
__init__.py Fix key_manager API call 2017-10-23 17:11:54 -04:00
conf_key_mgr.py Implement keymgr list() method 2017-09-07 07:27:48 -05:00