From 3a236a724e5a52e45fb13a1a36171caefd5916ae Mon Sep 17 00:00:00 2001 From: Feilong Wang Date: Tue, 25 Sep 2018 14:37:22 +1200 Subject: [PATCH] Support api-version when building client Magnum service API is using micro versions and to get the correct fuctions support, user or client have to initialize the correct client with parameter 'api_version'. This patch is following the same way as other OpenStack services to read the version from OPENSTACK_API_VERSIONS of Horizon local_settings.py. Change-Id: I85a3ed665dd6e5c9e9af933e0336d2be7998b928 --- magnum_ui/api/magnum.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/magnum_ui/api/magnum.py b/magnum_ui/api/magnum.py index 839c96de..7e59160a 100644 --- a/magnum_ui/api/magnum.py +++ b/magnum_ui/api/magnum.py @@ -106,8 +106,9 @@ def _create_patches(old, new): @memoized def magnumclient(request): magnum_url = "" + service_type = 'container-infra' try: - magnum_url = base.url_for(request, 'container-infra') + magnum_url = base.url_for(request, service_type) except exceptions.ServiceCatalogException: LOG.debug('No Container Infrastructure Management service is ' 'configured.') @@ -118,12 +119,15 @@ def magnumclient(request): insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None) + openstack_api_versions = getattr(settings, 'OPENSTACK_API_VERSIONS', {}) + magnum_api_version = openstack_api_versions.get(service_type, 1.1) c = magnum_client.Client(username=request.user.username, project_id=request.user.tenant_id, input_auth_token=request.user.token.id, magnum_url=magnum_url, insecure=insecure, + api_version=magnum_api_version, cacert=cacert) return c