Error getting keystone related informations when running keystone in httpd

Bug #1295128 reported by Liyingjun
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Liyingjun
Icehouse
Fix Released
Undecided
Deliang Fan

Bug Description

1. Need to deploy keystone on apache: http://docs.openstack.org/developer/keystone/apache-httpd.html
2. Update keystone endpoints to, http://192.168.94.129/keystone/main/v2.0 and http://192.168.94.129/keystone/main/v2.0
3. Edit openstack_dashboard/local/local_settings.py, update OPENSTACK_KEYSTONE_URL = "http://%s/keystone/main/v2.0" % OPENSTACK_HOST
4. Visit dashboard,
 * Error on dashboard: `Error: Unable to retrieve project list.`
 * Error in log:
Not Found: Not Found (HTTP 404)
Traceback (most recent call last):
  File "/opt/stack/horizon/openstack_dashboard/dashboards/admin/overview/views.py", line 63, in get_data
    projects, has_more = api.keystone.tenant_list(self.request)
  File "/opt/stack/horizon/openstack_dashboard/api/keystone.py", line 266, in tenant_list
    tenants = manager.list(limit, marker)
  File "/opt/stack/python-keystoneclient/keystoneclient/v2_0/tenants.py", line 118, in list
    tenant_list = self._list("/tenants%s" % query, "tenants")
  File "/opt/stack/python-keystoneclient/keystoneclient/base.py", line 106, in _list
    resp, body = self.client.get(url)
  File "/opt/stack/python-keystoneclient/keystoneclient/httpclient.py", line 578, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/opt/stack/python-keystoneclient/keystoneclient/httpclient.py", line 575, in _cs_request
    **kwargs)
  File "/opt/stack/python-keystoneclient/keystoneclient/httpclient.py", line 554, in request
    resp = super(HTTPClient, self).request(url, method, **kwargs)
  File "/opt/stack/python-keystoneclient/keystoneclient/baseclient.py", line 21, in request
    return self.session.request(url, method, **kwargs)
  File "/opt/stack/python-keystoneclient/keystoneclient/session.py", line 209, in request
    raise exceptions.from_response(resp, method, url)
NotFound: Not Found (HTTP 404)

But using the keystoneclient command line everything works fine..
$ keystone tenant-list
+----------------------------------+--------------------+---------+
| id | name | enabled |
+----------------------------------+--------------------+---------+
| 9542f4d212064b96addcfbca9fd530ee | admin | True |
| 5e317523a51745d1a65f4b166b85dd1b | demo | True |
| 70058501677e4c2ea7cef31a7ddbd48d | invisible_to_admin | True |
| 246ef23151354782aa75850cde8501e8 | service | True |
+----------------------------------+--------------------+---------+

Revision history for this message
Liyingjun (liyingjun) wrote :

_get_endpoint_url in openstack_dashboards/api/keystone.py is the source of the problem.
the url is generated by the following codes:

    bits = urlparse.urlparse(url)
    root = "://".join((bits.scheme, bits.netloc))
    url = "%s/v%s" % (root, VERSIONS.active)

this will generate the url like: http://127.0.0.1/v3, but if keystone is running on apache, the right url should be: http://127.0.0.1/keystone/main/v3

Liyingjun (liyingjun)
Changed in horizon:
assignee: nobody → Liyingjun (liyingjun)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/81832

Changed in horizon:
status: New → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/81832
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=48a0d07e45bac04393978776c63b67cd7c71415d
Submitter: Jenkins
Branch: master

commit 48a0d07e45bac04393978776c63b67cd7c71415d
Author: liyingjun <email address hidden>
Date: Thu Feb 13 02:42:51 2014 +0800

    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

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → juno-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/118992

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/icehouse)

Reviewed: https://review.openstack.org/118992
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=e32a00dc32b5feaac210439e2e5ecb2b84d9a22d
Submitter: Jenkins
Branch: stable/icehouse

commit e32a00dc32b5feaac210439e2e5ecb2b84d9a22d
Author: liyingjun <email address hidden>
Date: Thu Feb 13 02:42:51 2014 +0800

    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
    (cherry picked from commit 48a0d07e45bac04393978776c63b67cd7c71415d)

tags: added: in-stable-icehouse
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.