Some API requests (GET networks) fail with "Accept: application/json; charset=utf-8" header and WebOb>=1.8.0
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Fix Released
|
Medium
|
Dan Radez |
Bug Description
Original downstream bug: https:/
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://
GET http://
GET http://
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://
{
"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-
mai 14 18:16:19 devstack neutron-
mai 14 18:16:19 devstack neutron-
mai 14 18:16:19 devstack neutron-
mai 14 18:16:19 devstack neutron-
Relevant WebOb warning: https:/
tags: | added: api |
Changed in neutron: | |
assignee: | nobody → Dan Radez (dradez) |
Changed in neutron: | |
status: | Confirmed → In Progress |
I believe we have conclusively determined in [1] that this is not a WebOb issue. I believe that there may be different codepaths between the neutron API methods that see this issue and those that do not. I will note that the error seen in the Neutron server.log when this happens tells me that it is not handling parsing the string correctly.
% curl -s -H "Accept: application/ json;charset= utf-8" -H "X-Auth-Token: gAAAAABc0cHuHmv z0YFb0uuPv5ADSx i5Vda_pi- Z8KwIeqjfIu2Mtj BLA6NaoRorAjS8H rPzbmrby0K28uaj yYj5GiKIJcMCDDY RhN1Hs_ 2Bfb-4ORbBBj2_ X7o2gnybxaBak- TVdrQWdWsHyYnBf Tq5CCT- K_mCwPd4KgQfUto M6_4IUzDPKnQ" "http:// 192.168. 24.1:9696/ v2.0/networks"
{
"NeutronError": {
"detail": "",
"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.",
"type": "HTTPNotAcceptable"
}
}
The logs:
2019-05-07 14:47:47.341 77 DEBUG neutron.wsgi [-] (77) accepted ('172.17.1.31', 36530) server /usr/lib/ python2. 7/site- packages/ eventlet/ wsgi.py: 883 e917-4e3e- 82cf-d3dbd931b6 b2 21ec7039924a46e 9aec6a9fa490da0 66 fb53e9370fb0427 fadb680238d9098 7a - default default] Controller 'index' defined does not support content_type 'None'. Supported type(s): ['application/ json'] pecan_wsgi. hooks.translati on [req-58872c3a- e917-4e3e- 82cf-d3dbd931b6 b2 21ec7039924a46e 9aec6a9fa490da0 66 fb53e9370fb0427 fadb680238d9098 7a - default default] GET failed (client error): The server could not comply with the request since it is either malformed or otherwise incorrect. e917-4e3e- 82cf-d3dbd931b6 b2 21ec7039924a46e 9aec6a9fa490da0 66 fb53e9370fb0427 fadb680238d9098 7a - default default] 172.17.1.31 "GET /v2.0/networks HTTP/1.1" status: 406 len: 360 time: 0.0057609
2019-05-07 14:47:47.345 77 ERROR pecan.core [req-58872c3a-
2019-05-07 14:47:47.346 77 INFO neutron.
2019-05-07 14:47:47.347 77 INFO neutron.wsgi [req-58872c3a-
It gets weirder. This is only a problem for certain methods.
/v2.0/address- scopes is fine:
[stack@undercloud-0 ~]$ curl -s -H "Accept: application/ json;charset= utf-8" -H "X-Auth-Token: gAAAAABc0cHuHmv z0YFb0uuPv5ADSx i5Vda_pi- Z8KwIeqjfIu2Mtj BLA6NaoRorAjS8H rPzbmrby0K28uaj yYj5GiKIJcMCDDY RhN1Hs_ 2Bfb-4ORbBBj2_ X7o2gnybxaBak- TVdrQWdWsHyYnBf Tq5CCT- K_mCwPd4KgQfUto M6_4IUzDPKnQ" "http:// 192.168. 24.1:9696/ v2.0/address- scopes" | python -mjson.tool scopes" : []
{
"address_
}
/v2.0/ports is no good:
[stack@undercloud-0 ~]$ curl -s -H "Accept: application/ json;charset= utf-8" -H "X-Auth-Token: gAAAAABc0cHuHmv z0YFb0uuPv5ADSx i5Vda_pi- Z8KwIeqjfIu2Mtj BLA6NaoRorAjS8H rPzbmrby0K28uaj yYj5GiKIJcMCDDY RhN1Hs_ 2Bfb-4ORbBBj2_ X7o2gnybxaBak- TVdrQWdWsHyYnBf Tq5CCT- K_mCwPd4KgQfUto M6_4IUzDPKnQ" "http:// 192.168. 24.1: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"
}
}
/v2.0/flavors is fine:
[stack@undercloud-0 ~]$ curl -s -H "Accept: application/ json;charset= utf-8" -H "X-Auth-Token: gAAAAABc0cHuHmv z0YFb0uuPv5ADSx i5Vda_pi- Z8KwIeqjfIu2Mtj BLA6NaoRorAjS8H rPzbmrby0K28uaj yYj5GiKIJcMCDDY RhN1Hs_ 2Bfb-4ORbBBj2_ X7o2gnybxaBak- TVdrQWdWsHyYnBf Tq5CCT- K_mCwPd4KgQfU. ..