Comment 7 for bug 1616357

Revision history for this message
Esha Seth (eshaseth) wrote : Re: The Error Response REST API GET/POST on networks is not translated

There are 2 issues here related to GET/POST networks api

The POST call for which defect was raised is returning the webob/exc.py HTTPNotFound(HTTPClientError) which is a 404 and is not translated.(https://github.com/Pylons/webob/blob/master/webob/exc.py line 702

Example:
When tried to modify a non existing network id the resource not found message received is not translated when another language is enabled (always returns english)

Post :https://<serverip>/openstack/network/v2.0//networks/dcea3730-ddc6-48cf-a1e9-26cea79074d0

Body:
{"network":{"name":"Vlan456","provider:network_type":"vlan","provider:physical_network":"default","provider:segmentation_id":457}}

Response (using RestClient) :

<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<h1>404 Not Found</h1>
The resource could not be found.<br /><br />
</body>
</html>

The GET call for invalid data is returning a NeutronError of NetworkNotFound but the message here is not translated. I think this is related to convert_exception_to_http_exc in https://github.com/openstack/neutron/blob/master/neutron/api/api_common.py

Though according to https://github.com/openstack/neutron-lib/blob/master/neutron_lib/exceptions.py NetworkNotFound at line 115 should be translated.

Example:
Invalid ID:
GET:https://<ip>/openstack/network/v2.0/networks/dcea3730-ddc6-48cf-a1e9-26cea79074d9

Response:
 {
    "NeutronError":
    {
        "message": "Network dcea3730-ddc6-48cf-a1e9-26cea79074d9 could not be found.",
        "type": "NetworkNotFound",
        "detail": ""
    }
}

"Network dcea3730-ddc6-48cf-a1e9-26cea79074d9 could not be found." message should get translated to other language and not always return english.

We need both these to translated.