Merge "Support api-version when building client"

This commit is contained in:
Zuul 2018-10-02 04:47:02 +00:00 committed by Gerrit Code Review
commit b3941a8860
1 changed files with 5 additions and 1 deletions

View File

@ -107,8 +107,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.')
@ -119,12 +120,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