REST API responses from CinderExceptions are not being translated

Bug #1229967 reported by Luis A. Garcia on 2013-09-24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Luis A. Garcia

Bug Description

Unlike error that result from HTTPExceptions, the error responses that result from CinderExceptions are not being translated anymore.

To reproduce an example:

Try the following request:
POST /v2/{tenant-id}/snapshots
{"snapshot": {"volume_id": "99"}}
Accept-Language: es (or some language installed)
Content-Type: application/json

This will result in the following:

    "itemNotFound": {
        "message": "VolumeNotFound: Volume 99 could not be found.",
        "code": 404

That is, an English response (or the default locale's) even if the requested locale is available.

PS: Invalid and NotAuthorized CinderExceptions are handled correctly

Luis A. Garcia (luisg-8) on 2013-09-24
Changed in cinder:
assignee: nobody → Luis A. Garcia (luisg-8)
Luis A. Garcia (luisg-8) on 2013-09-24
description: updated

Fix proposed to branch: master

Changed in cinder:
status: New → In Progress

Submitter: Jenkins
Branch: master

commit a1a898c4667b8e99d733f1391e0d325c8ce6e187
Author: Luis A. Garcia <email address hidden>
Date: Tue Sep 24 22:07:55 2013 +0000

    Fix translation of CinderExceptions in REST API

    When creating a Fault from a CinderException wrapped in an
    HTTPException, we were converting the inner explanation to unicode
    before it was able to reach the Fault's call() method which is where
    translation occurs, and unicode objects can't be translated.

    This patch preserves the CinderException's Message object and puts it in
    another Message object as the explanation to the HTTPException so it can
    be translated.

    Fixes bug: #1229967

    Change-Id: Ida71908b639da32b4b85846a117ef21da2fe685b

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-10-04
Changed in cinder:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in cinder:
milestone: havana-rc1 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers