diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-09-13 10:33:34 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-09-13 10:33:34 +0000 |
| commit | 0296a2d2499a634ef49c2545fd75d41f3219bfa5 (patch) | |
| tree | c14f019e7b26c5c1c3341ed033a5383fccde69b7 /nova/api | |
| parent | 0bf93c05079c6c7c30e28ca1e0fba54b381c36d5 (diff) | |
| parent | 760e59b8632edd8cbf395289e24f380ffd06f047 (diff) | |
Merge "Validate keypair create request body"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/keypairs.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nova/api/openstack/compute/contrib/keypairs.py b/nova/api/openstack/compute/contrib/keypairs.py index dc0c74b11..e5e1e37fd 100644 --- a/nova/api/openstack/compute/contrib/keypairs.py +++ b/nova/api/openstack/compute/contrib/keypairs.py @@ -70,8 +70,13 @@ class KeypairController(object): context = req.environ['nova.context'] authorize(context) - params = body['keypair'] - name = params['name'] + + try: + params = body['keypair'] + name = params['name'] + except KeyError: + msg = _("Invalid request body") + raise webob.exc.HTTPBadRequest(explanation=msg) try: if 'public_key' in params: |
