Merge "Add support for overriding mistral service type"

This commit is contained in:
Jenkins 2017-03-04 17:10:50 +00:00 committed by Gerrit Code Review
commit 474db2d18b
3 changed files with 11 additions and 1 deletions

View File

@ -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):

View File

@ -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"
}

View File

@ -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)