Fixed error message for negative values of min_disk and min_ram
In case of v1 api if min_disk or min_ram is passed with a negative value to the image create command, it returns 400 response with error message formatted to HTML entity. Eliminated special characters (>=) from error message, so it will not cause any encoding issues. Also with this change the error message for v1 api will be identical to v2 api. Closes-Bug: 1461776 Change-Id: I71a3cc3ed6bf14f3c0273df053667f1cbf99e98f
This commit is contained in:
parent
ea62e2e7a9
commit
b7a29b7825
|
@ -318,9 +318,7 @@ def get_image_meta_from_headers(response):
|
|||
param=key,
|
||||
extra_msg=extra)
|
||||
if result[key] < 0 and result[key] is not None:
|
||||
extra = (_("Image %(key)s must be >= 0 "
|
||||
"('%(value)s' specified).")
|
||||
% {'key': key, 'value': result[key]})
|
||||
extra = _('Cannot be a negative value.')
|
||||
raise exception.InvalidParameterValue(value=result[key],
|
||||
param=key,
|
||||
extra_msg=extra)
|
||||
|
|
|
@ -506,7 +506,7 @@ class TestGlanceAPI(base.IsolatedUnitTest):
|
|||
|
||||
expected = "Cannot convert image size 'invalid' to an integer."
|
||||
exec_bad_size_test('invalid', expected)
|
||||
expected = "Image size must be >= 0 ('-10' specified)."
|
||||
expected = "Cannot be a negative value."
|
||||
exec_bad_size_test(-10, expected)
|
||||
|
||||
def test_bad_image_name(self):
|
||||
|
|
Loading…
Reference in New Issue