Make error response better for patching flavors

In api v2.0, if updating flavor miss pool argument,
zaqar will return bad request, "one of 'pool' needs to be specified".
It's not clear enough since we only allow to update
pool in API v2.0.

Closes-Bug: #1540209
Change-Id: I8418f7b61065d3939bccf1d0cf262d7c8527d911
This commit is contained in:
wanghao 2016-02-01 11:40:37 +08:00
parent 7e3931afb2
commit 3d1ba45a13

View File

@ -187,12 +187,11 @@ class Resource(object):
@acl.enforce("flavors:update")
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
containing at least one of: 'pool', 'capabilities'. If
none are found, the request is flagged as bad. There is also
strict format checking through the use of
containing 'pool'. If none is found, the request is flagged as bad.
There is also strict format checking through the use of
jsonschema. Appropriate errors are returned in each case for
badly formatted input.
@ -206,7 +205,7 @@ class Resource(object):
if not any([(field in data) for field in EXPECT]):
LOG.debug(u'PATCH flavor, bad params')
raise wsgi_errors.HTTPBadRequestBody(
'One of `pool` needs to be specified'
'`pool` needs to be specified'
)
for field in EXPECT: