HTTPNotFound response does not contain enough explanation

Bug #1285437 reported by Ken'ichi Ohmichi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Ken'ichi Ohmichi

Bug Description

In each RESTful API, there are useful explanation messages for HTTPNotFound response in the implementation.
However, some messages are not output to the response.
For example, the implementation of the pause action API contains "Server not found" message for nonexistent server error, but now the message is not output into the response like the following:

$ curl -i 'http://localhost:8774/v2/<project-id>/servers/<nonexistent-server-id>/action' -X POST [..]" -d '{"pause": null}'
HTTP/1.1 404 Not Found
Content-Length: 78
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-a5282f5e-7e59-48cf-a86b-fe2e34347a2f
Date: Thu, 27 Feb 2014 10:21:52 GMT

{"itemNotFound": {"message": "The resource could not be found.", "code": 404}}
$

When receiving the above message, client may consider "what is not found? project, server, or action?"
so it is better to output right message into a response.

Changed in nova:
assignee: nobody → Ken'ichi Ohmichi (oomichi)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/76724

Changed in nova:
status: New → In Progress
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/76724
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=16e360d3a9183e9fd2b3dc163fe3e1ce4ec18e8b
Submitter: Jenkins
Branch: master

commit 16e360d3a9183e9fd2b3dc163fe3e1ce4ec18e8b
Author: Ken'ichi Ohmichi <email address hidden>
Date: Thu Feb 27 19:02:34 2014 +0900

    Fix the explanations of HTTPNotFound response

    Nova wsgi framework gets "explanation" from HTTPNotFound exception and
    outputs it into a response body as "message" attribute. Now some error
    explanations are passed to HTTPNotFound exception without explanation
    argument and they are not output to a response body. As the result,
    the default message "The resource could not be found." of wsgi library
    are output to a response body instead.

    This patch fixes them to output right message to a response body.

    Change-Id: I80d3a2da6258e94c485ce024eb310a63bcf39773
    Closes-Bug: #1285437

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :

There are the same problems in new APIs still.

Changed in nova:
status: Fix Committed → New
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/81675

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/81675
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=322bed90098c59244a903158262b5d938e90c08f
Submitter: Jenkins
Branch: master

commit 322bed90098c59244a903158262b5d938e90c08f
Author: Ken'ichi Ohmichi <email address hidden>
Date: Thu Mar 20 09:22:26 2014 +0900

    Fix the explanations of HTTPNotFound for new APIs

    Nova wsgi framework gets "explanation" from HTTPNotFound exception and
    outputs it into a response body as "message" attribute. Now some error
    explanations are passed to HTTPNotFound exception without explanation
    argument and they are not output to a response body. As the result,
    the default message "The resource could not be found." of wsgi library
    are output to a response body instead.

    This patch fixes them to output right message to a response body.

    The commit I80d3a2da6258e94c485ce024eb310a63bcf39773 has fixed this
    kind of bug already, but it cannot cover the ones of new APIs. Then
    this patch is necessary again.

    Change-Id: Ia784e09cda986a421e83c2820dfd0a2267867cdd
    Closes-Bug: #1285437

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-rc1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-rc1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.