diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-01-27 21:06:46 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-01-27 21:06:46 +0000 |
| commit | aefed532691f92c2e4b418afbef54479ac18ae57 (patch) | |
| tree | e9fa8636612db00388cc34ec340aacd0128f76d4 /nova/api | |
| parent | 58e652845e0762e62e3b7a8ec02e742c6a78ba11 (diff) | |
| parent | 845c5a621d8b9a1f5946894343aa1029806c4d52 (diff) | |
Merge "Added validation of name when creating a new keypair"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/keypairs.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/contrib/keypairs.py b/nova/api/openstack/compute/contrib/keypairs.py index 7cd919673..67a081c1a 100644 --- a/nova/api/openstack/compute/contrib/keypairs.py +++ b/nova/api/openstack/compute/contrib/keypairs.py @@ -84,6 +84,9 @@ class KeypairController(object): params = body['keypair'] name = params['name'] + if not 0 < len(name) < 256: + msg = _('Keypair name must be between 1 and 255 characters long') + raise webob.exc.HTTPBadRequest(explanation=msg) # NOTE(ja): generation is slow, so shortcut invalid name exception try: db.key_pair_get(context, context.user_id, name) |
