Getting the versions of the API fails

Bug #1609662 reported by Juan Antonio Osorio Robles
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zaqar
Fix Released
Undecided
Unassigned

Bug Description

so, doing a simple curl <host>:8888 fails with the following message to the client:
$ curl 192.0.2.1:8888
{
    "title": "Internal server error",
    "description": "LooseVersion instance has no attribute 'version'"
}
The following stack-trace can be seen in the zaqar logs:
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver [-] LooseVersion instance has no attribute 'version'
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver Traceback (most recent call last):
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver File "/usr/lib/python2.7/site-packages/falcon/api.py", line 187, in __call__
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver params)
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver File "/usr/lib/python2.7/site-packages/falcon/api.py", line 561, in _call_rsrc_mw
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver process_resource(req, resp, resource, params)
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver File "/usr/lib/python2.7/site-packages/zaqar/transport/wsgi/driver.py", line 61, in process_resource
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver return self.func(req, resp, params)
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver File "/usr/lib/python2.7/site-packages/zaqar/common/transport/wsgi/helpers.py", line 102, in extract_project_id
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver if not params['project_id'] and api_version >= LooseVersion('v1.1'):
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver File "/usr/lib64/python2.7/distutils/version.py", line 296, in __cmp__
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver return cmp(self.version, other.version)
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver AttributeError: LooseVersion instance has no attribute 'version'
2016-08-04 06:42:44.595 3363 ERROR zaqar.transport.wsgi.driver

This is because we try to get a version from the request's path, even if it doesn't need to be there, which is the case of the versions endpoint (or the / endpoint).

On the other hand, it seems that zaqar always checks for the project-id. Which is appropriate for all versions (or routes) except the root one.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to zaqar (master)

Reviewed: https://review.openstack.org/351039
Committed: https://git.openstack.org/cgit/openstack/zaqar/commit/?id=cf6210df07dc29cb952d33f9d65cec8b49b04718
Submitter: Jenkins
Branch: master

commit cf6210df07dc29cb952d33f9d65cec8b49b04718
Author: Juan Antonio Osorio Robles <email address hidden>
Date: Thu Aug 4 10:20:35 2016 +0300

    Don't check for project-id if accessing the / route

    The versions route (or / route) should be publicly accessible and is
    used for keystone discovery. We shouldn't be checking for the
    project-id if that's accessed. On the other hand, this also fixes the
    issue where the server crashes if no version is given.

    Change-Id: I0481ef6f3920c8ee56ea79ed5621206246b26299
    Closes-Bug: #1609662

Changed in zaqar:
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/zaqar 3.0.0.0b3

This issue was fixed in the openstack/zaqar 3.0.0.0b3 development milestone.

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.