Fix cache configuration checks
There were two different checks to see if a cache region was already configured with a backend. Both were changed to use the Region.is_configured property. The initial reason for this change was that the hasattr approach in the test fixture was causing some issues in Python 3. For some reason it was forcing the __get__ lookup on the descriptor and Python 2 did not. bp python3 Change-Id: I409656f5ede08160cc68d48e7a3a636328e3e9a6
This commit is contained in:
parent
b23951b5a0
commit
f9c5d75654
2
keystone/common/cache/core.py
vendored
2
keystone/common/cache/core.py
vendored
@ -118,7 +118,7 @@ def configure_cache_region(region):
|
|||||||
raise exception.ValidationError(
|
raise exception.ValidationError(
|
||||||
_('region not type dogpile.cache.CacheRegion'))
|
_('region not type dogpile.cache.CacheRegion'))
|
||||||
|
|
||||||
if 'backend' not in region.__dict__:
|
if not region.is_configured:
|
||||||
# NOTE(morganfainberg): this is how you tell if a region is configured.
|
# NOTE(morganfainberg): this is how you tell if a region is configured.
|
||||||
# There is a request logged with dogpile.cache upstream to make this
|
# There is a request logged with dogpile.cache upstream to make this
|
||||||
# easier / less ugly.
|
# easier / less ugly.
|
||||||
|
@ -29,7 +29,7 @@ class Cache(fixtures.Fixture):
|
|||||||
|
|
||||||
# NOTE(morganfainberg): The only way to reconfigure the CacheRegion
|
# NOTE(morganfainberg): The only way to reconfigure the CacheRegion
|
||||||
# object on each setUp() call is to remove the .backend property.
|
# object on each setUp() call is to remove the .backend property.
|
||||||
if hasattr(cache.REGION, 'backend'):
|
if cache.REGION.is_configured:
|
||||||
del cache.REGION.backend
|
del cache.REGION.backend
|
||||||
|
|
||||||
# ensure the cache region instance is setup
|
# ensure the cache region instance is setup
|
||||||
|
Loading…
Reference in New Issue
Block a user