diff options
-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) |