Fix endpoint error when running keystone on apache

When running keystone in httpd, horizon could not generate the
right keystone endpoint url. Fixes this issue by retrieving the
whole path from the service_catalog or OPENSTACK_KEYSTONE_URL
and generating a new url.

Change-Id: Id8459947498127e47700d9f690d4ed4d5cadbba9
Closes-bug: #1295128
This commit is contained in:
liyingjun 2014-02-13 02:42:51 +08:00
parent 62c766754d
commit 48a0d07e45
1 changed files with 2 additions and 3 deletions

View File

@ -113,9 +113,8 @@ def _get_endpoint_url(request, endpoint_type, catalog=None):
# TODO(gabriel): When the Service Catalog no longer contains API versions
# in the endpoints this can be removed.
bits = urlparse.urlparse(url)
root = "://".join((bits.scheme, bits.netloc))
url = "%s/v%s" % (root, VERSIONS.active)
url = url.rstrip('/')
url = urlparse.urljoin(url, 'v%s' % VERSIONS.active)
return url