yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #51476
[Bug 1519342] Re: Returns 500 when delete method is called with request body
Reviewed: https://review.openstack.org/253647
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=fdecc6268213eae005b9e1fd94bc9633fb83081f
Submitter: Jenkins
Branch: master
commit fdecc6268213eae005b9e1fd94bc9633fb83081f
Author: Yushiro FURUKAWA <y.furukawa_2@xxxxxxxxxxxxxx>
Date: Thu Dec 3 21:19:14 2015 +0900
Insert validation with request params for HTTP DELETE
When delete request is thrown with "request body", it returns 500.
This commit fixes the return code from 500 to 400(BadRequest).
Change-Id: Iadf1bc724f9bd1728d3f9d3c0da4f0675da97d30
Closes-Bug: #1519342
** Changed in: neutron
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1519342
Title:
Returns 500 when delete method is called with request body
Status in neutron:
Fix Released
Bug description:
In current neutron, if we execute "DELETE" method with request body,
the neutron-server returns 500(Internal server error). This request body should be correct JSON format as follows:
example: in case of "network"
{
"network":
{
"id": "5cc4e4b1-cab3-40a1-970b-9294c793295d"
}
}
It should be fixed 400(BadRequest) when execute "DELETE" method with an
unnecessary request body.
[Version]
trunk
[Server]
devstack(all-in-one)
[How to reproduce]
$ source devstack/openrc admin admin
$ export TOKEN=`openstack token issue|grep ' id '|get_field 2`
$ neutron net-list -c id -c name
+--------------------------------------+----------+
| id | name |
+--------------------------------------+----------+
| b3c4eaf1-2828-4c7f-a9ba-876b12d470b0 | private |
+--------------------------------------+----------+
$ curl -i -X DELETE -d '{"network":{"id":"b3c4eaf1-2828-4c7f-a9ba-876b12d470b0"}}' -H "x-auth-token:$TOKEN" 192.168.122.253:9696/v2.0/networks/b3c4eaf1-2828-4c7f-a9ba-876b12d470b0
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 150
X-Openstack-Request-Id: req-814b2033-6df0-4149-9b5b-f26a94a12f37
Date: Tue, 24 Nov 2015 12:38:55 GMT
{"NeutronError": {"message": "Request Failed: internal server error
while processing your request.", "type": "HTTPInternalServerError",
"detail": ""}}
[q-svc.log]
ERROR neutron.api.v2.resource [req-814b2033-6df0-4149-9b5b-f26a94a12f37 admin cb3d9e782f4c4537989a904a8cbefc69] delete failed
TRACE neutron.api.v2.resource Traceback (most recent call last):
TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/resource.py", line 83, in resource
TRACE neutron.api.v2.resource result = method(request=request, **args)
TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 147, in wrapper
TRACE neutron.api.v2.resource ectxt.value = e.inner_exc
TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 197, in __exit__
TRACE neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 137, in wrapper
TRACE neutron.api.v2.resource return f(*args, **kwargs)
TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 546, in delete
TRACE neutron.api.v2.resource obj_deleter(request.context, id, **kwargs)
TRACE neutron.api.v2.resource TypeError: delete_network() got an unexpected keyword argument 'body'
TRACE neutron.api.v2.resource
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1519342/+subscriptions
References