diff options
author | guang-yee <guang.yee@hp.com> | 2015-04-08 16:07:02 -0700 |
---|---|---|
committer | Doug Hellmann <doug@doughellmann.com> | 2015-04-15 19:52:32 +0000 |
commit | 21a1daeaad0e54c373ed91c9e6dbd6391c03eeff (patch) | |
tree | 9ef1f81ac90bdf69019550d45fc8f438d78ced6e | |
parent | e7f369191bb09c349c3c4b327b5558fbd1c3e77a (diff) | |
download | keystone-21a1daeaad0e54c373ed91c9e6dbd6391c03eeff.tar.gz |
make sure we properly initialize the backends before using the drivers
Change-Id: I298515dafd7f8eb8a02745d128296a0da596adf6
closes-bug: #1441386
(cherry picked from commit da2effe7f33f5822da33b3966e3afd386d6f43cb)
-rw-r--r-- | keystone/cli.py | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/keystone/cli.py b/keystone/cli.py index c50cebf44..1cb32d087 100644 --- a/keystone/cli.py +++ b/keystone/cli.py @@ -21,7 +21,7 @@ from oslo_config import cfg from oslo_log import log import pbr.version -from keystone import assignment +from keystone import backends from keystone.common import driver_hints from keystone.common import openssl from keystone.common import sql @@ -30,8 +30,6 @@ from keystone.common import utils from keystone import config from keystone import exception from keystone.i18n import _, _LW -from keystone import identity -from keystone import resource from keystone import token @@ -296,16 +294,16 @@ class MappingPurge(BaseApp): def get_domain_id(name): try: - identity.Manager() - # init assignment manager to avoid KeyError in resource.core - assignment.Manager() - resource_manager = resource.Manager() return resource_manager.get_domain_by_name(name)['id'] except KeyError: raise ValueError(_("Unknown domain '%(name)s' specified by " "--domain-name") % {'name': name}) validate_options() + drivers = backends.load_backends() + resource_manager = drivers['resource_api'] + mapping_manager = drivers['id_mapping_api'] + # Now that we have validated the options, we know that at least one # option has been specified, and if it was the --all option then this # was the only option specified. @@ -322,7 +320,6 @@ class MappingPurge(BaseApp): if CONF.command.type is not None: mapping['type'] = CONF.command.type - mapping_manager = identity.MappingManager() mapping_manager.purge_mappings(mapping) @@ -337,21 +334,9 @@ class DomainConfigUploadFiles(object): self.load_backends() def load_backends(self): - """Load the backends needed for uploading domain configs. - - We only need the resource and domain_config managers, but there are - some dependencies which mean we have to load the assignment and - identity managers as well. - - The order of loading the backends is important, since the resource - manager depends on the assignment manager, which in turn depends on - the identity manager. - - """ - identity.Manager() - assignment.Manager() - self.resource_manager = resource.Manager() - self.domain_config_manager = resource.DomainConfigManager() + drivers = backends.load_backends() + self.resource_manager = drivers['resource_api'] + self.domain_config_manager = drivers['domain_config_api'] def valid_options(self): """Validate the options, returning True if they are indeed valid. |