Allow compatibility with keystonemiddleware 4.0.0

On keystonemiddleware 4.0.0 the base class is called
_BaseAuthProtocol, which was later changed to BaseAuthProtocol.
Due to this change keystone would not work with the 4.0.0
version, while it was still accepted in the requirements.
This fixes it by providing a fallback to the old naming

Change-Id: I859a2d15e63c8c857b0bcbb15c757b716c8c43ba
Closes-Bug: 1623091
This commit is contained in:
Itxaka 2016-09-14 12:19:45 +02:00 committed by Steve Martinelli
parent 0340cd0150
commit 9bbb0ce7a8
1 changed files with 10 additions and 1 deletions

View File

@ -11,6 +11,15 @@
# under the License.
from keystonemiddleware import auth_token
# TODO(stevemar): Remove this check once global-requirements depends on a
# version of keystonemiddleware greater than 4.2.0. We caught this issue too
# late in the Newton development cycle to unfreeze global requirements.
try:
BaseAuthProtocol = auth_token.BaseAuthProtocol
except AttributeError:
BaseAuthProtocol = auth_token._BaseAuthProtocol
from oslo_log import log
from oslo_log import versionutils
@ -35,7 +44,7 @@ __all__ = ('AuthContextMiddleware',)
@dependency.requires('token_provider_api')
class AuthContextMiddleware(auth_token.BaseAuthProtocol):
class AuthContextMiddleware(BaseAuthProtocol):
"""Build the authentication context from the request auth token."""
def __init__(self, app):