Use the new fix_auth_url_version_prefix() call

It is a variation of existing fix_auth_url_version() call which
returns as a second value a boolean flag indicating whether the
auth_url was fixed to point to /v3 endpoint. So we could display a
more clear message to deployers from Horizon, based on the value of
this flag. The legacy fix_auth_url_version() call is to be phased out
as soon as Horizon cease to depend on it. Also provide a release note
about removing the old function.

Change-Id: I6c6a35b1c460e22dadf39634fce1bdfa257b8c63
Depends-On: I3a04d838a707465c8c6e81e0e6e2fcf918b7b059
This commit is contained in:
Timur Sufiev 2016-06-15 21:22:08 +03:00 committed by Timur Sufiev
parent c8f055359b
commit f09a9ce4c7
3 changed files with 20 additions and 2 deletions

View File

@ -113,13 +113,21 @@ def _get_endpoint_url(request, endpoint_type, catalog=None):
url = base.url_for(request,
service_type='identity',
endpoint_type=endpoint_type)
message = ("The Keystone URL in service catalog points to a v2.0 "
"Keystone endpoint, but v3 is specified as the API version "
"to use by Horizon. Using v3 endpoint for authentication.")
else:
auth_url = getattr(settings, 'OPENSTACK_KEYSTONE_URL')
url = request.session.get('region_endpoint', auth_url)
message = ("The OPENSTACK_KEYSTONE_URL setting points to a v2.0 "
"Keystone endpoint, but v3 is specified as the API version "
"to use by Horizon. Using v3 endpoint for authentication.")
# TODO(gabriel): When the Service Catalog no longer contains API versions
# in the endpoints this can be removed.
url = auth_utils.fix_auth_url_version(url)
url, url_fixed = auth_utils.fix_auth_url_version_prefix(url)
if url_fixed:
LOG.warning(message)
return url

View File

@ -133,7 +133,8 @@ def download_rc_file(request):
# make v3 specific changes
context['user_domain_name'] = request.user.user_domain_name
# sanity fix for removing v2.0 from the url if present
context['auth_url'] = utils.fix_auth_url_version(context['auth_url'])
context['auth_url'], _ = utils.fix_auth_url_version_prefix(
context['auth_url'])
context['os_identity_api_version'] = 3
context['os_auth_version'] = 3
return _download_rc_file_for_template(request, context, template)

View File

@ -0,0 +1,9 @@
---
deprecations:
- The function fix_auth_url_version() should be removed
from openstack_auth library as soon as Horizon no longer
needs it. The replacement function is fix_auth_url_version_prefix()
which returns a fixed url and a boolean flag indicating
if the url was actually fixed. Having a separate flag
allows to emit more precise warning messages about
inconsistencies in Keystone endpoint URL.