← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1747540] [NEW] Predictable error for invalid sort_key

 

Public bug reported:

Description
===========
Neutron return unpredictable error type & message on invalid various invalid sort_keys. There are at least three types of errors:

1. {"message": "Bad networks request: Attribute 'xxx' references another resource and cannot be used to sort 'xxx' resources.", "type": "BadRequest", "detail": ""}
2. {"message": "Bad networks request: 'xxx' is an invalid attribute for sort key.", "type": "BadRequest", "detail": ""}
3. {"message": "[u'xxx'] is invalid attribute for sort_keys", "type": "HTTPBadRequest", "detail": ""}

Reproduce
=========
1.
$ curl -g -i -X GET -H "X-Auth-Token: $TOKEN" 'http://10.0.0.19:9696/v2.0/networks?sort_dir=desc&sort_key=segments'
HTTP/1.1 400 Bad Request
Content-Type: application/json
Content-Length: 188
X-Openstack-Request-Id: req-6bfeeddb-ed4c-4d6e-a107-1d65cda75883
Date: Mon, 05 Feb 2018 23:17:22 GMT

{"NeutronError": {"message": "Bad networks request: Attribute 'segments'
references another resource and cannot be used to sort 'networks'
resources.", "type": "BadRequest", "detail": ""}}

2.
$ curl -g -i -X GET -H "X-Auth-Token: $TOKEN" 'http://10.0.0.19:9696/v2.0/networks?sort_dir=desc&sort_key=provider:physical_network'
HTTP/1.1 400 Bad Request
Content-Type: application/json
Content-Length: 156
X-Openstack-Request-Id: req-9c1179bc-fa49-4692-9719-3620617eddf0
Date: Mon, 05 Feb 2018 23:18:00 GMT

{"NeutronError": {"message": "Bad networks request:
'provider:physical_network' is an invalid attribute for sort key.",
"type": "BadRequest", "detail": ""}}

3.
$ curl -g -i -X GET -H "X-Auth-Token: $TOKEN" 'http://10.0.0.19:9696/v2.0/networks?sort_dir=desc&sort_key=xxx'
HTTP/1.1 400 Bad Request
Content-Length: 116
Content-Type: application/json
X-Openstack-Request-Id: req-a2b43d49-f16a-40ae-ba76-51d2162cb72b
Date: Mon, 05 Feb 2018 23:18:45 GMT

{"NeutronError": {"message": "[u'xxx'] is invalid attribute for
sort_keys", "type": "HTTPBadRequest", "detail": ""}}

Expected
========
The 'type' is the same and the 'message' is of the same form for request #1, #2 and #3.

Actual
======
The combination of 'message' and 'type' are of different forms for request #1, #2 and #3.

** Affects: neutron
     Importance: Undecided
     Assignee: Hongbin Lu (hongbin.lu)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Hongbin Lu (hongbin.lu)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1747540

Title:
  Predictable error for invalid sort_key

Status in neutron:
  New

Bug description:
  Description
  ===========
  Neutron return unpredictable error type & message on invalid various invalid sort_keys. There are at least three types of errors:

  1. {"message": "Bad networks request: Attribute 'xxx' references another resource and cannot be used to sort 'xxx' resources.", "type": "BadRequest", "detail": ""}
  2. {"message": "Bad networks request: 'xxx' is an invalid attribute for sort key.", "type": "BadRequest", "detail": ""}
  3. {"message": "[u'xxx'] is invalid attribute for sort_keys", "type": "HTTPBadRequest", "detail": ""}

  Reproduce
  =========
  1.
  $ curl -g -i -X GET -H "X-Auth-Token: $TOKEN" 'http://10.0.0.19:9696/v2.0/networks?sort_dir=desc&sort_key=segments'
  HTTP/1.1 400 Bad Request
  Content-Type: application/json
  Content-Length: 188
  X-Openstack-Request-Id: req-6bfeeddb-ed4c-4d6e-a107-1d65cda75883
  Date: Mon, 05 Feb 2018 23:17:22 GMT

  {"NeutronError": {"message": "Bad networks request: Attribute
  'segments' references another resource and cannot be used to sort
  'networks' resources.", "type": "BadRequest", "detail": ""}}

  2.
  $ curl -g -i -X GET -H "X-Auth-Token: $TOKEN" 'http://10.0.0.19:9696/v2.0/networks?sort_dir=desc&sort_key=provider:physical_network'
  HTTP/1.1 400 Bad Request
  Content-Type: application/json
  Content-Length: 156
  X-Openstack-Request-Id: req-9c1179bc-fa49-4692-9719-3620617eddf0
  Date: Mon, 05 Feb 2018 23:18:00 GMT

  {"NeutronError": {"message": "Bad networks request:
  'provider:physical_network' is an invalid attribute for sort key.",
  "type": "BadRequest", "detail": ""}}

  3.
  $ curl -g -i -X GET -H "X-Auth-Token: $TOKEN" 'http://10.0.0.19:9696/v2.0/networks?sort_dir=desc&sort_key=xxx'
  HTTP/1.1 400 Bad Request
  Content-Length: 116
  Content-Type: application/json
  X-Openstack-Request-Id: req-a2b43d49-f16a-40ae-ba76-51d2162cb72b
  Date: Mon, 05 Feb 2018 23:18:45 GMT

  {"NeutronError": {"message": "[u'xxx'] is invalid attribute for
  sort_keys", "type": "HTTPBadRequest", "detail": ""}}

  Expected
  ========
  The 'type' is the same and the 'message' is of the same form for request #1, #2 and #3.

  Actual
  ======
  The combination of 'message' and 'type' are of different forms for request #1, #2 and #3.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1747540/+subscriptions