← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1614022] Re: POST/PUT request is returned with 500 error when specifying non dictionary type as value of resource key

 

** Changed in: neutron
       Status: In Progress => Won't Fix

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

Title:
  POST/PUT request is returned with 500 error when specifying non
  dictionary type as value of resource key

Status in neutron:
  Won't Fix

Bug description:
  POST/PUT request is returned with 500 error when specifying non dictionary type as value of resource key.
  I assume that it should be returned with 400(BadRequest) error.

  Here are requests and logs of each(POST/PUT) cases.
  These are failed in different points.
    POST: 'populate_tenant_id' in neutron/api/v2/attributes.py
    PUT : 'verify_attributes' in neutron/api/v2/attributes.py

  Some validation is needed before processing the above methods.

  1. POST case
  request
  ========================
  ubuntu@test:/opt/stack/neutron$ curl -g -i -X POST http://172.16.1.31:9696/v2.0/networks -H "X-Auth-Token: $TOKEN" -d '{"network":[]}'
  HTTP/1.1 500 Internal Server Error
  Content-Type: application/json
  Content-Length: 150
  X-Openstack-Request-Id: req-acd88944-e402-4143-ac9d-dcbfbffe0648
  Date: Wed, 17 Aug 2016 09:22:05 GMT

  {"NeutronError": {"message": "Request Failed: internal server error while processing your request.", "type": "HTTPInternalServerError", "detail": ""}}
  ==========================

  trace in neutron-server
  ========================
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource [req-acd88944-e402-4143-ac9d-dcbfbffe0648 47e52753ff204767937cd1406fc15fb4 0059a1acf1b74638a4c17e26de720d3a -
   - -] create failed: No details.
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource Traceback (most recent call last):
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/resource.py", line 79, in resource
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     result = method(request=request, **args)
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 397, in create
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     return self._create(request, body, **kwargs)
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 151, in wrapper
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     ectxt.value = e.inner_exc
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     self.force_reraise()
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 139, in wrapper
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     return f(*args, **kwargs)
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/api.py", line 82, in wrapped
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     traceback.format_exc())
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     self.force_reraise()
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/api.py", line 77, in wrapped
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     return f(*args, **kwargs)
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 406, in _create
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     allow_bulk=self._allow_bulk)
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 675, in prepare_request_body
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     attributes.populate_tenant_id(context, res_dict, attr_info, is_create)
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/attributes.py", line 453, in populate_tenant_id
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource     res_dict['tenant_id'] = context.tenant_id
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource TypeError: list indices must be integers, not str
  2016-08-17 09:22:05.250 5683 ERROR neutron.api.v2.resource
  2016-08-17 09:22:05.253 5683 INFO neutron.wsgi [req-acd88944-e402-4143-ac9d-dcbfbffe0648 47e52753ff204767937cd1406fc15fb4 0059a1acf1b74638a4c17e26de720d3a - - -] 172.16
  .1.31 - - [17/Aug/2016 09:22:05] "POST /v2.0/networks HTTP/1.1" 500 344 1.459593
  ====================================

  2.PUT case
  request
  ====================================
  ubuntu@test:/opt/stack/neutron$ curl -g -i -X PUT http://172.16.1.31:9696/v2.0/networks/3629e273-6d0a-40b4-bdaf-f5ece0cc4583 -H "X-Auth-Token: $TOKEN" -d '{"network":[]}'
  HTTP/1.1 500 Internal Server Error
  Content-Type: application/json
  Content-Length: 150
  X-Openstack-Request-Id: req-352bcaf0-397f-43f5-9c6d-491aec11ac86
  Date: Wed, 17 Aug 2016 09:29:07 GMT

  {"NeutronError": {"message": "Request Failed: internal server error while processing your request.", "type": "HTTPInternalServerError", "detail": ""}}
  ====================================

  trace in neutron server
  ====================================
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource [req-352bcaf0-397f-43f5-9c6d-491aec11ac86 47e52753ff204767937cd1406fc15fb4 0059a1acf1b74638a4c17e26de720d3a -
   - -] update failed: No details.
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource Traceback (most recent call last):
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/resource.py", line 79, in resource
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     result = method(request=request, **args)
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 571, in update
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     return self._update(request, id, body, **kwargs)
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 151, in wrapper
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     ectxt.value = e.inner_exc
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     self.force_reraise()
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     self.force_reraise()
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 139, in wrapper
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     return f(*args, **kwargs)
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/api.py", line 82, in wrapped
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     traceback.format_exc())
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     self.force_reraise()
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/api.py", line 77, in wrapped
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     return f(*args, **kwargs)
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 578, in _update
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     allow_bulk=self._allow_bulk)
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 676, in prepare_request_body
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     attributes.verify_attributes(res_dict, attr_info)
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/attributes.py", line 461, in verify_attributes
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource     extra_keys = set(res_dict.keys()) - set(attr_info.keys())
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource AttributeError: 'list' object has no attribute 'keys'
  2016-08-17 09:29:07.820 5683 ERROR neutron.api.v2.resource
  2016-08-17 09:29:07.823 5683 INFO neutron.wsgi [req-352bcaf0-397f-43f5-9c6d-491aec11ac86 47e52753ff204767937cd1406fc15fb4 0059a1acf1b74638a4c17e26de720d3a - - -] 172.16.1.31 - - [17/Aug/2016 09:29:07] "PUT /v2.0/networks/3629e273-6d0a-40b4-bdaf-f5ece0cc4583 HTTP/1.1" 500 344 0.423484
  ====================================

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



References