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
This commit is contained in:
parent
3931063c35
commit
3a236a724e
|
@ -106,8 +106,9 @@ def _create_patches(old, new):
|
||||||
@memoized
|
@memoized
|
||||||
def magnumclient(request):
|
def magnumclient(request):
|
||||||
magnum_url = ""
|
magnum_url = ""
|
||||||
|
service_type = 'container-infra'
|
||||||
try:
|
try:
|
||||||
magnum_url = base.url_for(request, 'container-infra')
|
magnum_url = base.url_for(request, service_type)
|
||||||
except exceptions.ServiceCatalogException:
|
except exceptions.ServiceCatalogException:
|
||||||
LOG.debug('No Container Infrastructure Management service is '
|
LOG.debug('No Container Infrastructure Management service is '
|
||||||
'configured.')
|
'configured.')
|
||||||
|
@ -118,12 +119,15 @@ def magnumclient(request):
|
||||||
|
|
||||||
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
||||||
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
|
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,
|
c = magnum_client.Client(username=request.user.username,
|
||||||
project_id=request.user.tenant_id,
|
project_id=request.user.tenant_id,
|
||||||
input_auth_token=request.user.token.id,
|
input_auth_token=request.user.token.id,
|
||||||
magnum_url=magnum_url,
|
magnum_url=magnum_url,
|
||||||
insecure=insecure,
|
insecure=insecure,
|
||||||
|
api_version=magnum_api_version,
|
||||||
cacert=cacert)
|
cacert=cacert)
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue