Some API requests (GET networks) fail with "Accept: application/json; charset=utf-8" header and WebOb>=1.8.0

Bug #1829042 reported by Bernard Cafarelli on 2019-05-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Undecided
Unassigned

Bug Description

Original downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=1706222

On versions newer than Rocky, we have WebOb 1.8 in requirements. This causes the following API calls to end with 500 error:
GET http://localhost:9696/v2.0/ports
GET http://localhost:9696/v2.0/subnets
GET http://localhost:9696/v2.0/networks

when setting an Accept header with charset like "Accept: application/json; charset=utf-8"

These calls do not go through neutron.api.v2 and wsgi.request as other resources, is it something that should be fixed too?

To reproduce (on master too):
$ curl -s -H "Accept: application/json; charset=utf-8" -H "X-Auth-Token: $OS_TOKEN" "http://localhost:9696/v2.0/ports" | python -mjson.tool
{
    "NeutronError": {
        "detail": "",
        "message": "The server could not comply with the request since it is either malformed or otherwise incorrect.",
        "type": "HTTPNotAcceptable"
    }
}

mai 14 18:16:19 devstack neutron-server[1519]: DEBUG neutron.wsgi [-] (1533) accepted ('127.0.0.1', 47790) {{(pid=1533) server /usr/lib/python2.7/site-packages/eventlet/wsgi.py:956}}
mai 14 18:16:19 devstack neutron-server[1519]: ERROR pecan.core [None req-0848fbc9-5c8a-4713-b436-029814f89a32 None demo] content type None
mai 14 18:16:19 devstack neutron-server[1519]: ERROR pecan.core [None req-0848fbc9-5c8a-4713-b436-029814f89a32 None demo] Controller 'index' defined does not support content_type 'None'. Supported type(s): ['application/json']
mai 14 18:16:19 devstack neutron-server[1519]: INFO neutron.pecan_wsgi.hooks.translation [None req-0848fbc9-5c8a-4713-b436-029814f89a32 None demo] GET failed (client error): The server could not comply with the request since it is either malformed or otherwise incorrect.
mai 14 18:16:19 devstack neutron-server[1519]: INFO neutron.wsgi [None req-0848fbc9-5c8a-4713-b436-029814f89a32 None demo] 127.0.0.1 "GET /v2.0/ports HTTP/1.1" status: 406 len: 360 time: 0.2243972

Relevant WebOb warning: https://github.com/Pylons/webob/blob/master/docs/whatsnew-1.8.txt#L24

Tags: api Edit Tag help
tags: added: api
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers