Keypair create with invalid Json Is not throwing a proper exception

Bug #1049619 reported by Sirisha Devineni
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Sirisha Devineni

Bug Description

Key pair create with invalid Json request is expected to throw a BadRequest but throwing Http 500 error.

root@ubuntu1204:~/launchpad_nova/nova# curl -i http://127.0.0.1:8774/v2/4c9c3d480e124b34bc5fdc701a038a8c/os-keypairs -X POST -H "X-Auth-Project-Id: demo" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: b9e401f79ff44432870d824ee8c1564c" -d'{"alpha": {"name": "test3"}}'
HTTP/1.1 500 Internal Server Error
Via: 1.1 HYSPROXY2, 1.1 HYSPROXY1
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 128
Date: Wed, 12 Sep 2012 16:05:19 GMT
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-9fcfd552-8793-4191-83b4-32227e95ae95

{"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}root@ubuntu1204:~/launchpad_nova/nova#
root@ubuntu1204:~/launchpad_nova/nova# vi /var/log/syslog
root@ubuntu1204:~/launchpad_nova/nova# vi /var/log/nova/
root@ubuntu1204:~/launchpad_nova/nova# curl -i http://10.233.52.28:8774/v2/4c9c3d480e124b34bc5fdc701a038a8c/os-keypairs -X POST -H "X-Auth-Project-Id: demo" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: b9e401f79ff44432870d824ee8c1564c" -d'{"keypair": {"name2": "test3"}}'
HTTP/1.1 500 Internal Server Error
Via: 1.1 HYSPROXY2, 1.1 HYSPROXY1
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 128
Date: Wed, 12 Sep 2012 16:09:02 GMT
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-72f8cb3b-f19f-4b8c-8028-fb8638f66da6

{"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}

Here keypair and name are the mandatory keys that should present in the request body. If user skips those keys in req body and tries to create a keypair, expecting an user readable error message.

Changed in nova:
assignee: nobody → Sirisha Devineni (sirisha-devineni)
Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/12873

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/12873
Committed: http://github.com/openstack/nova/commit/760e59b8632edd8cbf395289e24f380ffd06f047
Submitter: Jenkins
Branch: master

commit 760e59b8632edd8cbf395289e24f380ffd06f047
Author: Sirisha Devineni <email address hidden>
Date: Thu Sep 13 00:00:32 2012 +0530

    Validate keypair create request body

    Check if keypair create request body has manditory keys like keypair, name
    and raise HTTPBadRequest if the required keys are missing.

    Fixes bug 1049619

    Change-Id: Ia6129e1b04e910fbea81b62b921a228aafa32f64

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → folsom-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-rc1 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.