diff options
author | Monty Taylor <mordred@inaugust.com> | 2015-10-14 10:18:59 -0400 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2015-10-14 10:18:59 -0400 |
commit | 6113d037f6240666e3c958db6e83a242e7c8531d (patch) | |
tree | 368537a19f074246368b214c8e1cde05644b0be6 | |
parent | f65655258618cae7f6052035792d528d499dea3b (diff) | |
download | os-client-config-6113d037f6240666e3c958db6e83a242e7c8531d.tar.gz |
Pass OpenStackConfig in to CloudConfig for caches
The unit of consumption is the CloudConfig object, but the cache
settings are found only globally in the OpenStackConfig object. Pass
the OpenStackConfig object in so that a user consuming settings from
a CloudConfig can find out what the cache settings are.
Change-Id: I633e35b1d7f295581d7abed9c3957e802690614e
-rw-r--r-- | os_client_config/cloud_config.py | 20 | ||||
-rw-r--r-- | os_client_config/config.py | 7 |
2 files changed, 25 insertions, 2 deletions
diff --git a/os_client_config/cloud_config.py b/os_client_config/cloud_config.py index c8b5269..f0c4143 100644 --- a/os_client_config/cloud_config.py +++ b/os_client_config/cloud_config.py @@ -17,12 +17,14 @@ import warnings class CloudConfig(object): def __init__(self, name, region, config, - force_ipv4=False, auth_plugin=None): + force_ipv4=False, auth_plugin=None, + openstack_config=None): self.name = name self.region = region self.config = config self._force_ipv4 = force_ipv4 self._auth = auth_plugin + self._openstack_config = openstack_config def __getattr__(self, key): """Return arbitrary attributes.""" @@ -116,3 +118,19 @@ class CloudConfig(object): def get_auth(self): """Return a keystoneauth plugin from the auth credentials.""" return self._auth + + def get_cache_interval(self): + if self._openstack_config: + return self._openstack_config.get_cache_interval() + + def get_cache_path(self): + if self._openstack_config: + return self._openstack_config.get_cache_path() + + def get_cache_class(self): + if self._openstack_config: + return self._openstack_config.get_cache_class() + + def get_cache_arguments(self): + if self._openstack_config: + return self._openstack_config.get_cache_arguments() diff --git a/os_client_config/config.py b/os_client_config/config.py index c87870d..6d37835 100644 --- a/os_client_config/config.py +++ b/os_client_config/config.py @@ -221,6 +221,9 @@ class OpenStackConfig(object): new_config[key] = value return new_config + def get_cache_interval(self): + return self._cache_max_age + def get_cache_max_age(self): return self._cache_max_age @@ -629,7 +632,9 @@ class OpenStackConfig(object): name=cloud_name, region=config['region_name'], config=self._normalize_keys(config), force_ipv4=force_ipv4, - auth_plugin=auth_plugin) + auth_plugin=auth_plugin, + openstack_config=self + ) @staticmethod def set_one_cloud(config_file, cloud, set_config=None): |