Fixing Senlin incompatibility with openstacksdk 0.11.x

When running Heat with OpenstackSDK 0.11.3 (or older)
no clustering version is being passed on, causing the
call to Senlin to fail with the following error message.
> Unknown version in URI from

With this patch we always set the api version for clustering.

Change-Id: I61876b599373c5794bb9edb2088b15d21f7584e2
Closes-Bug: #1760932
Story: #1760932
Task: #18787
(cherry picked from commit d47a4540dc)
This commit is contained in:
Erik Olof Gunnar Andersson 2018-04-03 23:33:59 -07:00
parent 825731d81b
commit 55533a19f7
2 changed files with 10 additions and 1 deletions

View File

@ -42,9 +42,13 @@ class OpenStackSDKPlugin(client_plugin.ClientPlugin):
config=self._get_service_interfaces(),
region_name=self._get_region_name(),
app_name='heat',
app_version=heat.version.version_info.version_string())
app_version=heat.version.version_info.version_string(),
**self._get_additional_create_args(version))
return connection.Connection(config=config)
def _get_additional_create_args(self, version):
return {}
def _get_service_interfaces(self):
interfaces = {}
if not os_service_types:

View File

@ -29,6 +29,11 @@ class SenlinClientPlugin(sdk_plugin.OpenStackSDKPlugin):
client = super(SenlinClientPlugin, self)._create(version=version)
return client.clustering
def _get_additional_create_args(self, version):
return {
'clustering_api_version': version or '1'
}
def generate_spec(self, spec_type, spec_props):
spec = {'properties': spec_props}
spec['type'], spec['version'] = spec_type.split('-')