Resolve oauth dependency after paste pipeline is loaded

When trying to authenticate with the oauth plugin, it is
possible that the dependency is not yet loaded, and as a result
the user will receive an error message: "Oauth is disabled"

This patch will ensure the dependency is loaded after the pipeline

Fixes: bug #1264803

Change-Id: I37484bf844896b1a1b560923a8afaf99e91635e4
This commit is contained in:
Steve Martinelli 2014-01-06 16:41:06 -06:00
parent f33ec9e5bc
commit 8bf22c34fa
4 changed files with 15 additions and 9 deletions

View File

@ -42,6 +42,7 @@ from keystone.openstack.common import gettextutils
# contain static translated strings.
gettextutils.install('keystone')
from keystone.common import dependency
from keystone.common import environment
from keystone.common import sql
from keystone.common import utils
@ -137,4 +138,6 @@ if __name__ == '__main__':
'main',
CONF.public_bind_host,
int(CONF.public_port)))
dependency.resolve_future_dependencies()
serve(*servers)

View File

@ -26,6 +26,7 @@ from keystone.openstack.common import gettextutils
# contain static translated strings.
gettextutils.install('keystone')
from keystone.common import dependency
from keystone.common import environment
from keystone.common import sql
from keystone import config
@ -54,3 +55,5 @@ drivers = service.load_backends()
# http://pythonpaste.org/deploy/
application = deploy.loadapp('config:%s' % config.find_paste_config(),
name=name)
dependency.resolve_future_dependencies()

View File

@ -21,7 +21,6 @@ from keystone import assignment
from keystone import auth
from keystone import catalog
from keystone.common import cache
from keystone.common import dependency
from keystone.common import wsgi
from keystone import config
from keystone.contrib import endpoint_filter
@ -43,7 +42,7 @@ LOG = logging.getLogger(__name__)
cache.configure_cache_region(cache.REGION)
def load_backends(include_oauth1=False):
def load_backends():
# Ensure that the identity driver is created before the assignment manager.
# The default assignment driver is determined by the identity driver, so
@ -61,12 +60,6 @@ def load_backends(include_oauth1=False):
trust_api=trust.Manager(),
token_provider_api=token.provider.Manager())
if include_oauth1:
from keystone.contrib import oauth1
DRIVERS['oauth1_api'] = oauth1.Manager()
dependency.resolve_future_dependencies()
return DRIVERS

View File

@ -349,7 +349,14 @@ class TestCase(testtools.TestCase):
# should eventually be removed once testing has been cleaned up.
kvs_core.KEY_VALUE_STORE_REGISTRY.clear()
drivers = service.load_backends(include_oauth1=True)
drivers = service.load_backends()
# TODO(stevemar): currently, load oauth1 driver as well, eventually
# we need to have this as optional.
from keystone.contrib import oauth1
drivers['oauth1_api'] = oauth1.Manager()
dependency.resolve_future_dependencies()
for manager_name, manager in drivers.iteritems():
setattr(self, manager_name, manager)