Merge "Refactor common function for loading drivers"
This commit is contained in:
commit
3c9e2e5c83
|
@ -53,6 +53,10 @@ def response_truncated(f):
|
|||
return wrapper
|
||||
|
||||
|
||||
def load_driver(driver_name, *args):
|
||||
return importutils.import_object(driver_name, *args)
|
||||
|
||||
|
||||
class Manager(object):
|
||||
"""Base class for intermediary request layer.
|
||||
|
||||
|
@ -67,7 +71,7 @@ class Manager(object):
|
|||
"""
|
||||
|
||||
def __init__(self, driver_name):
|
||||
self.driver = importutils.import_object(driver_name)
|
||||
self.driver = load_driver(driver_name)
|
||||
|
||||
def __getattr__(self, name):
|
||||
"""Forward calls to the underlying driver."""
|
||||
|
|
|
@ -21,7 +21,6 @@ import uuid
|
|||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
from keystone import clean
|
||||
|
@ -90,8 +89,8 @@ class DomainConfigs(dict):
|
|||
_any_sql = False
|
||||
|
||||
def _load_driver(self, domain_config):
|
||||
return importutils.import_object(
|
||||
domain_config['cfg'].identity.driver, domain_config['cfg'])
|
||||
return manager.load_driver(domain_config['cfg'].identity.driver,
|
||||
domain_config['cfg'])
|
||||
|
||||
def _assert_no_more_than_one_sql_driver(self, domain_id, new_config,
|
||||
config_file=None):
|
||||
|
|
Loading…
Reference in New Issue