diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-01-30 16:15:55 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-01-30 16:15:55 +0000 |
| commit | 378ba501f082c772b2e8f90921fc38289730dfa1 (patch) | |
| tree | 9c9bd81acb924834739af3df662f1437578735e4 /nova/api | |
| parent | 6a239cb7a2ea05a9382ed71469ca770afbb12212 (diff) | |
| parent | 9fa7db58c22b3a4ba238d3cb9d39233968439cb1 (diff) | |
Merge "Raise 400 if bad kepair data is provided"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/keypairs.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/contrib/keypairs.py b/nova/api/openstack/compute/contrib/keypairs.py index 67a081c1a..512f8660a 100644 --- a/nova/api/openstack/compute/contrib/keypairs.py +++ b/nova/api/openstack/compute/contrib/keypairs.py @@ -99,7 +99,12 @@ class KeypairController(object): # import if public_key is sent if 'public_key' in params: - fingerprint = crypto.generate_fingerprint(params['public_key']) + try: + fingerprint = crypto.generate_fingerprint(params['public_key']) + except exception.InvalidKeypair: + msg = _("Keypair data is invalid") + raise webob.exc.HTTPBadRequest(explanation=msg) + keypair['public_key'] = params['public_key'] keypair['fingerprint'] = fingerprint else: |
