summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2017-02-15 09:31:12 -0600
committerMonty Taylor <mordred@inaugust.com>2017-02-15 09:31:12 -0600
commit0e039e67c2e3496628141b7b48aff2ff541096c6 (patch)
tree1b43bed046c88ce24a86c3bf06a57a4aa9d4c735
parentcbb38f38bceee7977952651bd0466902c087de8d (diff)
downloados-client-config-0e039e67c2e3496628141b7b48aff2ff541096c6.tar.gz
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
-rw-r--r--os_client_config/cloud_config.py4
-rw-r--r--os_client_config/defaults.json3
-rw-r--r--os_client_config/tests/test_cloud_config.py5
3 files changed, 11 insertions, 1 deletions
diff --git a/os_client_config/cloud_config.py b/os_client_config/cloud_config.py
index f52756f..5c4c03e 100644
--- a/os_client_config/cloud_config.py
+++ b/os_client_config/cloud_config.py
@@ -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):
diff --git a/os_client_config/defaults.json b/os_client_config/defaults.json
index 65f8961..2a195c4 100644
--- a/os_client_config/defaults.json
+++ b/os_client_config/defaults.json
@@ -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"
}
diff --git a/os_client_config/tests/test_cloud_config.py b/os_client_config/tests/test_cloud_config.py
index 6f960e6..ce724cb 100644
--- a/os_client_config/tests/test_cloud_config.py
+++ b/os_client_config/tests/test_cloud_config.py
@@ -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)