From 2713168dd1f513a1427ab69da3138793ee5cfb8b Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 9 Nov 2015 15:50:28 -0500 Subject: [PATCH] Pull server list cache setting via API To ensure that we get numbers and not strings from OCC for cache settings, we need to use the actual API for that, not direct data introspection. Change-Id: I457c624ebfcda6578417fb977ea3742a63507344 --- requirements.txt | 2 +- shade/openstackcloud.py | 3 +-- shade/tests/unit/test_caching.py | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index c69d12e97..53190d185 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ munch decorator jsonpatch ipaddress -os-client-config>=1.9.0 +os-client-config>=1.10.1 requestsexceptions>=1.1.1 six diff --git a/shade/openstackcloud.py b/shade/openstackcloud.py index 0dc62435b..c554fa3b9 100644 --- a/shade/openstackcloud.py +++ b/shade/openstackcloud.py @@ -173,7 +173,6 @@ class OpenStackCloud(object): cache_expiration_time = int(cloud_config.get_cache_expiration_time()) cache_class = cloud_config.get_cache_class() cache_arguments = cloud_config.get_cache_arguments() - cache_expiration = cloud_config.get_cache_expiration() if cache_class != 'dogpile.cache.null': self._cache = cache.make_region( @@ -209,7 +208,7 @@ class OpenStackCloud(object): # If server expiration time is set explicitly, use that. Otherwise # fall back to whatever it was before - self._SERVER_LIST_AGE = cache_expiration.get( + self._SERVER_LIST_AGE = cloud_config.get_cache_resource_expiration( 'server', self._SERVER_LIST_AGE) self._container_cache = dict() diff --git a/shade/tests/unit/test_caching.py b/shade/tests/unit/test_caching.py index 5715b7132..a637c7994 100644 --- a/shade/tests/unit/test_caching.py +++ b/shade/tests/unit/test_caching.py @@ -33,6 +33,9 @@ class TestMemoryCache(base.TestCase): { 'max_age': 90, 'class': 'dogpile.cache.memory', + 'expiration': { + 'server': 1, + }, }, 'clouds': {