Merge "Prevent infinite recursion on persistence core on init"

This commit is contained in:
Jenkins 2014-09-25 05:12:49 +00:00 committed by Gerrit Code Review
commit d8d1477d83
1 changed files with 8 additions and 0 deletions

View File

@ -228,6 +228,14 @@ class Manager(object):
def __getattr__(self, item):
"""Forward calls to the `token_provider_api` persistence manager."""
# NOTE(morganfainberg): Prevent infinite recursion, raise an
# AttributeError for 'token_provider_api' ensuring that the dep
# injection doesn't infinitely try and lookup self.token_provider_api
# on _process_dependencies. This doesn't need an exception string as
# it should only ever be hit on instantiation.
if item == 'token_provider_api':
raise AttributeError()
f = getattr(self.token_provider_api._persistence, item)
LOG.warning(_LW('`token_api.%s` is deprecated as of Juno in favor of '
'utilizing methods on `token_provider_api` and may be '