Activity log for bug #1662228

Date Who What changed Old value New value Message
2017-02-06 16:18:58 Sam Betts bug added bug
2017-02-06 16:19:52 Sam Betts description Error responses from the Ironic API return as a double JSON encoded error message. An example of this is: {"error_message": "{\"debuginfo\": null, \"faultcode\": \"Client\", \"faultstring\": \"The requested action \\\"provide\\\" can not be performed on node \\\"7c b3fb9f-780e-48ab-8e22-20dff73d4b1d\\\" while it is in state \\\"active\\\".\"}"} The JSON dictionary inside of error_message does not need to be string encoded, this results in applications consuming the API to have to decode the outer body of the response and then (and only if the error_message exists) decode again the internal body of the message. Even our own python-ironicclient falls victim to this: https://github.com/openstack/python-ironicclient/blob/master/ironicclient/common/http.py#L77 After some investigation it appears the response ends up encoded this way because of two separate places: https://github.com/openstack/wsme/blob/ecaf3aa40f0fc09a30bf2e47b42bf4c4314c1dc0/wsmeext/pecan.py#L109 and https://github.com/openstack/ironic/blob/master/ironic/api/middleware/parsable_error.py#L35 The first place creates the {\"debuginfo\": null, \"faultcode\": \"Client\", \"faultstring\": \"The requested action \\\"provide\\\" can not be performed on node \\\"7c b3fb9f-780e-48ab-8e22-20dff73d4b1d\\\" while it is in state \\\"active\\\".\"} body, and then the middleware wraps it the second time. Error responses from the Ironic API return as a double JSON encoded error message. An example of this is: {"error_message": "{\"debuginfo\": null, \"faultcode\": \"Client\", \"faultstring\": \"The requested action \\\"provide\\\" can not be performed on node \\\"7c b3fb9f-780e-48ab-8e22-20dff73d4b1d\\\" while it is in state \\\"active\\\".\"}"} The JSON dictionary inside of error_message does not need to be string encoded, this results in applications consuming the API to have to decode the outer body of the response and then (and only if the error_message exists) decode again the internal body of the message. Even our own python-ironicclient falls victim to this: https://github.com/openstack/python-ironicclient/blob/master/ironicclient/common/http.py#L77 After some investigation it appears the response ends up encoded this way because of two separate places: https://github.com/openstack/wsme/blob/ecaf3aa40f0fc09a30bf2e47b42bf4c4314c1dc0/wsmeext/pecan.py#L109 and https://github.com/openstack/ironic/blob/master/ironic/api/middleware/parsable_error.py#L35 The first place creates the {\"debuginfo\": null, \"faultcode\": \"Client\", \"faultstring\": \"The requested action \\\"provide\\\" can not be performed on node \\\"7c b3fb9f-780e-48ab-8e22-20dff73d4b1d\\\" while it is in state \\\"active\\\".\"} body, and then the middleware wraps it the second time.
2017-02-06 19:04:17 Jay Faulkner ironic: importance Undecided Medium
2017-02-06 19:04:20 Jay Faulkner ironic: status New Triaged
2017-02-07 03:39:06 Ramamani Yeleswarapu ironic: assignee Ramamani Yeleswarapu (ramamani-yeleswarapu)
2017-02-15 04:25:53 Ramamani Yeleswarapu ironic: assignee Ramamani Yeleswarapu (ramamani-yeleswarapu)
2018-01-09 07:24:08 Abdallah Banishamsa ironic: assignee Abdallah Banishamsa (abdallahb)
2018-03-06 17:20:08 Dmitry Tantsur ironic: assignee Abdallah Banishamsa (abdallahb)