diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py index 8dc384a53f..eb80da7cec 100644 --- a/openstack_dashboard/api/keystone.py +++ b/openstack_dashboard/api/keystone.py @@ -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 diff --git a/openstack_dashboard/dashboards/project/access_and_security/api_access/views.py b/openstack_dashboard/dashboards/project/access_and_security/api_access/views.py index b499a06bac..212abfbf4c 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/api_access/views.py +++ b/openstack_dashboard/dashboards/project/access_and_security/api_access/views.py @@ -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) diff --git a/releasenotes/notes/fix-precise-keystone-endpoint-message-03129e37a6377715.yaml b/releasenotes/notes/fix-precise-keystone-endpoint-message-03129e37a6377715.yaml new file mode 100644 index 0000000000..8712e2e625 --- /dev/null +++ b/releasenotes/notes/fix-precise-keystone-endpoint-message-03129e37a6377715.yaml @@ -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.