[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[keystone][placement][neutron][api-sig] http404 to NotFound, or how should a http json error body look like?


Recently I planned to add tests to the neutron feature routed provider 
networks, which actually uses placement API to make possible the 
scheduling based on neutron segment information.
I realized that the feature last worked on Queens. We can discuss 
separately the lack of test coverage, and similar things, but I would 
like to narrow or view now.
The neutron bug report, with some background information:

After some debugging I realized that the problem comes from the fact 
that at a point neutron uses the information received in http404, like this:
     return self._get(url).json()
except keystoneauth1.exceptions.NotFound as e:
     if 'foo' in e.details:

keystoneauth1 expects the http body in case of for example http404 to be 
something like this (python dict comes now):
body= {'error': {'message': 'Foooooo', 'details': 'Baaaaar'}}

But placement started to adopt one suggestion from the API-SIG:,

and that is something like this (again python):
body={'errors': [{'status': 404, 'title': 'Not Found', 'detail': 'The 
resource could not be found.... ', 'request_id': '...'}]}

Shall I ask for help how I should make this bug in neutron fixed?
As a quick and dirty solution in neutron I can use the response from the 
exception, but I feel that there should be a better way to fix this:-)

Thanks in advance for the help