yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #62908
[Bug 1477921] Re: Create/Update port responds 500 to the request with invalid "security_groups"
Reviewed: https://review.openstack.org/358468
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=4f4d9ad3d33da85df2530347617b9dbc33543e54
Submitter: Jenkins
Branch: master
commit 4f4d9ad3d33da85df2530347617b9dbc33543e54
Author: hobo.kengo <hobo.kengo@xxxxxxxxxxxxxx>
Date: Mon Aug 22 03:21:53 2016 +0000
Add validation for security_groups parameter in Port
Currently, we check whether specified value in list
matches with UUID format or not.
However, we don't check whether data type of specified value of
security_groups key is list in the first place.
This patch adds check above.
Change-Id: If027df3ff34b219e4a043934b9461ac0fcb40156
Closes-Bug: #1477921
** 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/1477921
Title:
Create/Update port responds 500 to the request with invalid
"security_groups"
Status in neutron:
Fix Released
Bug description:
When I request "POST /v2.0/ports/" and "PUT /v2.0/ports/{port_id}" with an invalid value(ex.integer) as "security_groups",
Neutron Server responds 500(Internal Server Error).
It should respond 400 error not 500 error.
API Result and Logs are as follows.
[API Result]
"POST /v2.0/ports/"
stack@ubuntu:~$ curl -gi -X POST http://192.168.122.99:9696/v2.0/ports -H "X-Auth-Token:${TOKEN}" -d '{"port":{"security_groups":90,"network_id":"77e2f811-96
a5-48d2-bd85-132e4f44bcb4"}}'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 150
X-Openstack-Request-Id: req-b1e6de3d-8cd0-4015-be65-141126e7c807
Date: Fri, 24 Jul 2015 09:06:07 GMT
{"NeutronError": {"message": "Request Failed: internal server error
while processing your request.", "type": "HTTPInternalServerError",
"detail": ""}}
"PUT /v2.0/ports/{port_id}"
stack@ubuntu:~$ curl -gi -X PUT http://192.168.122.99:9696/v2.0/ports/f95f74ff-1ede-483b-9386-c51f470500fe -H "X-Auth-Token:${TOKEN}" -d '{"port":{"security_groups":90}}'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 150
X-Openstack-Request-Id: req-4815865b-9631-4812-9424-3b73c997e56f
Date: Fri, 24 Jul 2015 08:46:51 GMT
{"NeutronError": {"message": "Request Failed: internal server error
while processing your request.", "type": "HTTPInternalServerError",
"detail": ""}}
[Neutron Server Log]
2015-07-24 17:46:41.947 DEBUG neutron.api.v2.base req-4f4adaa0-3952-4a0f-a450-7b3594c5a11e demo 0522fc19a56b4d7ca32a9140d3d36a08 Request body: {u'port': {u'security_groups': 3}}from (pid=24319) prepare_request_body /opt/stack/neutron/neutron/api/v2/base.py:606
2015-07-24 17:46:41.949 ERROR neutron.api.v2.resource req-4f4adaa0-3952-4a0f-a450-7b3594c5a11e demo 0522fc19a56b4d7ca32a9140d3d36a08 update failed
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource Traceback (most recent call last):
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/resource.py", line 83, in resource
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource result = method(request=request, **args)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 146, in wrapper
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource ectxt.value = e.inner_exc
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 119, in __exit__
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 136, in wrapper
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource return f(*args, **kwargs)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 525, in update
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource allow_bulk=self._allow_bulk)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 658, in prepare_request_body
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource res_dict[attr] = attr_vals['convert_to'](res_dict[attr])
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/extensions/securitygroup.py", line 177, in convert_to_uuid_list_or_none
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource for sg_id in value_list:
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource TypeError: 'int' object is not iterable
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource
2015-07-24 17:46:41.955 INFO neutron.wsgi req-4f4adaa0-3952-4a0f-a450-7b3594c5a11e demo 0522fc19a56b4d7ca32a9140d3d36a08192.168.122.99 - - [24/Jul/2015 17:46:41] "PUT /v2.0/ports/f95f74ff-1ede-483b-9386-c51f470500fe HTTP/1.1" 500 359 0.027116
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1477921/+subscriptions
References