Module loader docs

Change-Id: Ie44f8d56ebc18edefdd4c132dd14e36c2b18e544
This commit is contained in:
Terry Howe
2015-05-22 17:11:34 -07:00
parent 25049be285
commit b9b6fac079
3 changed files with 15 additions and 1 deletions

View File

@@ -117,6 +117,7 @@ can be customized.
identity_base
identity_v2
identity_v3
module_loader
resource
service_filter
utils

View File

@@ -0,0 +1,10 @@
ModuleLoader
============
.. automodule:: openstack.module_loader
ModuleLoader object
--------------------
.. autoclass:: openstack.module_loader.ModuleLoader
:members:

View File

@@ -11,7 +11,7 @@
# under the License.
"""
Load various modules for authorization and services.
Load various modules for authorization and eventually services.
"""
from stevedore import extension
@@ -21,12 +21,14 @@ from openstack import exceptions
class ModuleLoader(object):
def __init__(self):
"""Create a module loader."""
self.auth_mgr = extension.ExtensionManager(
namespace="openstack.auth.plugin",
invoke_on_load=False,
)
def get_auth_plugin(self, plugin_name):
"""Get an authentication plugin by name."""
if not plugin_name:
plugin_name = 'identity'
try:
@@ -36,4 +38,5 @@ class ModuleLoader(object):
raise exceptions.NoMatchingPlugin(msg)
def list_auth_plugins(self):
"""Get a list of all the authentication plugins."""
return self.auth_mgr.names()