8a3e7c5a95
The API-sig has a guideline[1] for including error codes in error responses to help distinguish errors with the same status code from one another. This change provides a simplest-thing-that-could- possibly-work solution to make that go. This solution comes about after a few different constraints and attempts: * We would prefer to go on using the existing webob.exc exceptions, not make subclasses. * We already have a special wrapper around our wsgi apps to deal with setting the json_error_formatter. * Though webob allows custom Request and Response objects, it uses the default Response object as the parent of the HTTP exceptions. * The Response object accepts kwargs, but only if they can be associated with known attributes on the class. Since we can't subclass... * The json_error_formatter method is not passed the raw exception, but it does get the current WSGI environ * The webob.exc classes take a 'comment' kwarg that is not used, but is also not passed to the json_error_formatter. Therefore, when we raise an exception, we can set 'comment' to a code and then assign that comment to a well known field in the environ and if that environ is set in json_error_formatter, we can set 'code' in the output. This is done in a new microversion, 1.23. Every response gets a default code 'placement.undefined_code' from 1.23 on. Future development will add specific codes where required. This change adds a stub code for inventory in use when doing a PUT to .../inventories but the name may need improvement. [1] http://specs.openstack.org/openstack/api-wg/guidelines/errors.html Implements blueprint placement-api-error-handling Change-Id: I9a833aa35d474caa35e640bbad6c436a3b16ac5e |
||
---|---|---|
.. | ||
add-aggregate-type-extra-specs-affinity-filter-79a2d3ee152b8ecd.yaml | ||
aggregate-uuid-generation-1f029af7a9af519b.yaml | ||
aggregates-moved-to-api-database-e1bd30909aaf79d3.yaml | ||
allocation_candidates_support_member_of-92f7e1440ed63fe7.yaml | ||
allocation-candidates-limit-37fe5c2ce57daf7f.yaml | ||
allocation-candidates-traits-1adf079ed0c6563c.yaml | ||
bp-symmetric-allocations-6ff7b270c32dcb7d.yaml | ||
bug-1732000-log-options-6db2cc8c747145ca.yaml | ||
delete-inventories-placement-api-13582910371308c4.yaml | ||
idempotent-put-resource-class-dc7a267c823b7995.yaml | ||
placement-aggregate-generation-9dad79fb0356fcc0.yaml | ||
placement-allocation-candidates-1114a843755b93c4.yaml | ||
placement-allocations-link-in-get-resource-providers-0b1d26a264eceb4b.yaml | ||
placement-api-endpoint-interface-set-29af8b9400ce7775.yaml | ||
placement-api-member-of-d8a08d0d0c5700d7.yaml | ||
placement-cors-c7a83e8c63787736.yaml | ||
placement-error-code-fcbbf5d45560984e.yaml | ||
placement-forbidden-traits-ace037856aa29a09.yaml | ||
placement-generation-from-create-provider-203a0ac1ebfe64d9.yaml | ||
placement-last-modified-cf43aece4c54fc97.yaml | ||
placement-required-traits-on-list-resource-providers-fab11cdb36cd3502.yaml | ||
placement-rest-api-filter-providers-by-resources-0ab51c9766fe654f.yaml | ||
placement-rest-api-nested-resource-providers-552a923a96d7adca.yaml | ||
placement-rest-custom-resource-classes-a3f2175772983b0a.yaml | ||
placement-traits-api-efa17d46ea1b616b.yaml | ||
post-allocations-427581fa41671820.yaml | ||
return-uuid-attribute-for-aggregates-70d9f733f86fb1a3.yaml | ||
tenant_aggregate_placement_filter-c2fed8889f43b6e3.yaml |