shim FAULT_MAP from neutron-lib

Idfd956fa213e1ba6c3b1c983f246c5b515951e6d rehomed the FAULT_MAP into
neutron-lib. Since consumers expect to access the latest faults in this
map which are updated by neutron at runtime, we can't just move
consumers over to lib's version (it won't be updated by neutron).

Therefore this patch shims neutron's FAULT_MAP to use lib's. Once
this shim lands consumers can move to lib's FAULT_MAP (neutron will
ref it via shim) and finally we can then consume in neutron and remove
in a subsequent patch.

The shim herein shouldn't impact consumers so should be free to land
without worry of their impact.

Change-Id: I8e79f29206ec244d870e19f99c18ccaaa50b4761
This commit is contained in:
Boden R 2017-10-18 09:43:42 -06:00
parent 1ffabf9463
commit 7e0d37699f
1 changed files with 3 additions and 10 deletions

View File

@ -16,8 +16,8 @@
import collections
import copy
import netaddr
from neutron_lib.api import attributes
from neutron_lib.api import faults
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
from neutron_lib import exceptions
@ -40,15 +40,8 @@ from neutron.quota import resource_registry
LOG = logging.getLogger(__name__)
FAULT_MAP = {exceptions.NotFound: webob.exc.HTTPNotFound,
exceptions.Conflict: webob.exc.HTTPConflict,
exceptions.InUse: webob.exc.HTTPConflict,
exceptions.BadRequest: webob.exc.HTTPBadRequest,
exceptions.ServiceUnavailable: webob.exc.HTTPServiceUnavailable,
exceptions.NotAuthorized: webob.exc.HTTPForbidden,
netaddr.AddrFormatError: webob.exc.HTTPBadRequest,
oslo_policy.PolicyNotAuthorized: webob.exc.HTTPForbidden
}
# TODO(boden): remove shim once consumers are using lib's FAULT_MAP
FAULT_MAP = faults.FAULT_MAP
class Controller(object):