diff options
author | Monty Taylor <mordred@inaugust.com> | 2016-10-20 08:41:18 -0500 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2016-10-21 07:07:03 -0500 |
commit | 3f525e01798b433732139a9bff88d9360613cd71 (patch) | |
tree | cbdeaca5d2da215324b4f14aa87b8f31bfc4d197 | |
parent | 47068d0abbb1018e238213af30cf7840bb2104d9 (diff) | |
download | os-client-config-3f525e01798b433732139a9bff88d9360613cd71.tar.gz |
Add support for volumev3 service type
Words cannot begin to adequately express the disappointment and rage I
felt upon learning that the cinder team had unleashed 'volumev3' upon
the world. Woe betide us, the mere users, for wanting to use a 'volume'
endpoint and have that choice mean something. Perhaps if we beat
ourselves with leather straps while crawling for days across the country
we can remove more joy from our lives. In the meantime, until we can
fully appreciate the existential crisis of being, let's continue to work
around it in os-client-config.
Change-Id: I171e3b01497b3e3a06c3a73577f0f67e0c1e6f73
-rw-r--r-- | os_client_config/cloud_config.py | 9 | ||||
-rw-r--r-- | os_client_config/tests/test_cloud_config.py | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/os_client_config/cloud_config.py b/os_client_config/cloud_config.py index 147eb04..82442bb 100644 --- a/os_client_config/cloud_config.py +++ b/os_client_config/cloud_config.py @@ -160,9 +160,12 @@ class CloudConfig(object): # atrocity from the as-yet-unsullied eyes of our users. # Of course, if the user requests a volumev2, that structure should # still work. - if (service_type == 'volume' and - self.get_api_version(service_type).startswith('2')): - service_type = 'volumev2' + # What's even more amazing is that they did it AGAIN with cinder v3 + if service_type == 'volume': + if self.get_api_version(service_type).startswith('2'): + service_type = 'volumev2' + elif self.get_api_version(service_type).startswith('3'): + service_type = 'volumev3' return self.config.get(key, service_type) def get_service_name(self, service_type): diff --git a/os_client_config/tests/test_cloud_config.py b/os_client_config/tests/test_cloud_config.py index 2763f4d..e3d1d5d 100644 --- a/os_client_config/tests/test_cloud_config.py +++ b/os_client_config/tests/test_cloud_config.py @@ -158,6 +158,11 @@ class TestCloudConfig(base.TestCase): cc.config['volume_api_version'] = '2' self.assertEqual('volumev2', cc.get_service_type('volume')) + def test_volume_override_v3(self): + cc = cloud_config.CloudConfig("test1", "region-al", fake_services_dict) + cc.config['volume_api_version'] = '3' + self.assertEqual('volumev3', cc.get_service_type('volume')) + def test_get_session_no_auth(self): config_dict = defaults.get_defaults() config_dict.update(fake_services_dict) |