Merge "Make error response better for patching flavors"

This commit is contained in:
Jenkins 2016-02-10 14:52:30 +00:00 committed by Gerrit Code Review
commit e8e3a9def2

View File

@ -187,12 +187,11 @@ class Resource(object):
@acl.enforce("flavors:update") @acl.enforce("flavors:update")
def on_patch(self, request, response, project_id, flavor): def on_patch(self, request, response, project_id, flavor):
"""Allows one to update a flavors's pool and/or capabilities. """Allows one to update a flavors's pool.
This method expects the user to submit a JSON object This method expects the user to submit a JSON object
containing at least one of: 'pool', 'capabilities'. If containing 'pool'. If none is found, the request is flagged as bad.
none are found, the request is flagged as bad. There is also There is also strict format checking through the use of
strict format checking through the use of
jsonschema. Appropriate errors are returned in each case for jsonschema. Appropriate errors are returned in each case for
badly formatted input. badly formatted input.
@ -206,7 +205,7 @@ class Resource(object):
if not any([(field in data) for field in EXPECT]): if not any([(field in data) for field in EXPECT]):
LOG.debug(u'PATCH flavor, bad params') LOG.debug(u'PATCH flavor, bad params')
raise wsgi_errors.HTTPBadRequestBody( raise wsgi_errors.HTTPBadRequestBody(
'One of `pool` needs to be specified' '`pool` needs to be specified'
) )
for field in EXPECT: for field in EXPECT: