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
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)
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)
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': ""}