Ensure that fault map translations work correctly
The patch does two things: 1. make the code validation of the code checks more generic 2. enables a extended fault map to be treated correctly (for example https://github.com/openstack/vmware-nsx/blob/master/vmware_nsx/plugins/nsx_mh/plugin.py#L769) Change-Id: Idc89c0ece2e6ff3b0368f431fea098128bd68c34
This commit is contained in:
parent
01dd6de276
commit
5f972ef406
|
@ -15,13 +15,11 @@
|
|||
|
||||
import functools
|
||||
|
||||
import netaddr
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
import oslo_i18n
|
||||
from oslo_log import log as logging
|
||||
from oslo_policy import policy as oslo_policy
|
||||
from oslo_serialization import jsonutils
|
||||
from six.moves.urllib import parse
|
||||
from webob import exc
|
||||
|
@ -429,8 +427,8 @@ def convert_exception_to_http_exc(e, faults, language):
|
|||
e.body = body
|
||||
e.content_type = kwargs['content_type']
|
||||
return e
|
||||
if isinstance(e, (exceptions.NeutronException, netaddr.AddrFormatError,
|
||||
oslo_policy.PolicyNotAuthorized)):
|
||||
faults_tuple = tuple(faults.keys()) + (exceptions.NeutronException,)
|
||||
if isinstance(e, faults_tuple):
|
||||
for fault in faults:
|
||||
if isinstance(e, fault):
|
||||
mapped_exc = faults[fault]
|
||||
|
|
Loading…
Reference in New Issue