Module loader docs
Change-Id: Ie44f8d56ebc18edefdd4c132dd14e36c2b18e544
This commit is contained in:
@@ -117,6 +117,7 @@ can be customized.
|
|||||||
identity_base
|
identity_base
|
||||||
identity_v2
|
identity_v2
|
||||||
identity_v3
|
identity_v3
|
||||||
|
module_loader
|
||||||
resource
|
resource
|
||||||
service_filter
|
service_filter
|
||||||
utils
|
utils
|
||||||
|
10
doc/source/users/module_loader.rst
Normal file
10
doc/source/users/module_loader.rst
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
ModuleLoader
|
||||||
|
============
|
||||||
|
.. automodule:: openstack.module_loader
|
||||||
|
|
||||||
|
|
||||||
|
ModuleLoader object
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
.. autoclass:: openstack.module_loader.ModuleLoader
|
||||||
|
:members:
|
@@ -11,7 +11,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Load various modules for authorization and services.
|
Load various modules for authorization and eventually services.
|
||||||
"""
|
"""
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
|
|
||||||
@@ -21,12 +21,14 @@ from openstack import exceptions
|
|||||||
class ModuleLoader(object):
|
class ModuleLoader(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
"""Create a module loader."""
|
||||||
self.auth_mgr = extension.ExtensionManager(
|
self.auth_mgr = extension.ExtensionManager(
|
||||||
namespace="openstack.auth.plugin",
|
namespace="openstack.auth.plugin",
|
||||||
invoke_on_load=False,
|
invoke_on_load=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_auth_plugin(self, plugin_name):
|
def get_auth_plugin(self, plugin_name):
|
||||||
|
"""Get an authentication plugin by name."""
|
||||||
if not plugin_name:
|
if not plugin_name:
|
||||||
plugin_name = 'identity'
|
plugin_name = 'identity'
|
||||||
try:
|
try:
|
||||||
@@ -36,4 +38,5 @@ class ModuleLoader(object):
|
|||||||
raise exceptions.NoMatchingPlugin(msg)
|
raise exceptions.NoMatchingPlugin(msg)
|
||||||
|
|
||||||
def list_auth_plugins(self):
|
def list_auth_plugins(self):
|
||||||
|
"""Get a list of all the authentication plugins."""
|
||||||
return self.auth_mgr.names()
|
return self.auth_mgr.names()
|
||||||
|
Reference in New Issue
Block a user