Add support for overriding mistral service type
The mistral team copied the heinous pervsion that the cinder team propagated upon the world and appended a version to their service_type. That's ok - there is nice copy-pastable code here we can use to prevent users from feeling the pain. Change-Id: Icf280f932014e4d9abeab3e944aece125988562e
This commit is contained in:
parent
cbb38f38bc
commit
0e039e67c2
@ -161,11 +161,15 @@ class CloudConfig(object):
|
||||
# Of course, if the user requests a volumev2, that structure should
|
||||
# still work.
|
||||
# What's even more amazing is that they did it AGAIN with cinder v3
|
||||
# And then I learned that mistral copied it.
|
||||
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'
|
||||
elif service_type == 'workflow':
|
||||
if self.get_api_version(service_type).startswith('2'):
|
||||
service_type = 'workflowv2'
|
||||
return self.config.get(key, service_type)
|
||||
|
||||
def get_service_name(self, service_type):
|
||||
|
@ -22,5 +22,6 @@
|
||||
"orchestration_api_version": "1",
|
||||
"secgroup_source": "neutron",
|
||||
"status": "active",
|
||||
"volume_api_version": "2"
|
||||
"volume_api_version": "2",
|
||||
"workflow_api_version": "2"
|
||||
}
|
||||
|
@ -163,6 +163,11 @@ class TestCloudConfig(base.TestCase):
|
||||
cc.config['volume_api_version'] = '3'
|
||||
self.assertEqual('volumev3', cc.get_service_type('volume'))
|
||||
|
||||
def test_workflow_override_v2(self):
|
||||
cc = cloud_config.CloudConfig("test1", "region-al", fake_services_dict)
|
||||
cc.config['workflow_api_version'] = '2'
|
||||
self.assertEqual('workflowv2', cc.get_service_type('workflow'))
|
||||
|
||||
def test_get_session_no_auth(self):
|
||||
config_dict = defaults.get_defaults()
|
||||
config_dict.update(fake_services_dict)
|
||||
|
Loading…
Reference in New Issue
Block a user