Allow 0 length name
There are currently cases where nova for example creates volumes with a name of zero length. We can't just change that and break compatability. This patch just modifes the wsgi module to allow min length of zero again. Change-Id: I829a8b4d6773d1c646d07cccb36994370e1dbce9 Closes-Bug: #1485198
This commit is contained in:
parent
31cb1f2377
commit
480b8737e3
@ -1228,7 +1228,7 @@ class Controller(object):
|
||||
body['name'] = name.strip()
|
||||
try:
|
||||
utils.check_string_length(body['name'], 'Name',
|
||||
min_length=1, max_length=255)
|
||||
min_length=0, max_length=255)
|
||||
except exception.InvalidInput as error:
|
||||
raise webob.exc.HTTPBadRequest(explanation=error.msg)
|
||||
|
||||
|
@ -622,8 +622,6 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
|
||||
|
||||
self.assertEqual(400, res.status_int)
|
||||
self.assertEqual(400, res_dict['badRequest']['code'])
|
||||
self.assertEqual('Name has a minimum character requirement of 1.',
|
||||
res_dict['badRequest']['message'])
|
||||
|
||||
db.consistencygroup_destroy(ctxt.elevated(), consistencygroup_id)
|
||||
|
||||
|
@ -1022,10 +1022,11 @@ class ValidBodyTest(test.TestCase):
|
||||
body)
|
||||
|
||||
def test_validate_name_and_description_with_name_zero_length(self):
|
||||
# NOTE(jdg): We allow zero length names currently, particularly
|
||||
# from Nova, changes to this require an API version bump
|
||||
body = {'name': ""}
|
||||
self.assertRaises(webob.exc.HTTPBadRequest,
|
||||
self.controller.validate_name_and_description,
|
||||
body)
|
||||
self.controller.validate_name_and_description(body)
|
||||
self.assertEqual('', body['name'])
|
||||
|
||||
def test_validate_name_and_description_with_desc_zero_length(self):
|
||||
body = {'description': ""}
|
||||
|
Loading…
x
Reference in New Issue
Block a user