Prevent infinite recursion on persistence core on init
Raise an AttributeError for lookup on 'token_provider_api' within the __getattr__ on the keystone.token.persistence.core.Manager class. The __getattr__ will be called on dependency injection process dependencies and attempt to do a lookup on .token_provider_api, which nets an infinite recursion. If an AttributeError is raised the dependency processor will set the value correctly. Once the 'token_provider_api' attribute is set, __getattr__ is no longer called as the value is in the instantiated object's __dict__. Change-Id: I4af79f4568429dea27c1e11e5a77cefa5afc792c Closes-Bug: #1373167
This commit is contained in:
parent
1af24284bd
commit
4a0f0756d8
|
@ -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 '
|
||||
|
|
Loading…
Reference in New Issue