diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-10-15 09:58:13 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-10-15 09:58:13 +0000 |
commit | 6d73d089962579fd7295435e8226ef700603c166 (patch) | |
tree | 39eb063f3bb90388c2566adaa8bb8890d7fdef83 | |
parent | ec4ebbdd277c2125734640f2b3cd1184c4c6bf86 (diff) | |
parent | 6113d037f6240666e3c958db6e83a242e7c8531d (diff) | |
download | os-client-config-6d73d089962579fd7295435e8226ef700603c166.tar.gz |
Merge "Pass OpenStackConfig in to CloudConfig for caches"
-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): |