Merge "Use six.reraise() for Python 3 compatibility"
This commit is contained in:
commit
1efdfec59c
@ -97,7 +97,7 @@ class CinderException(Exception):
|
||||
LOG.error(_LE("%(name)s: %(value)s"),
|
||||
{'name': name, 'value': value})
|
||||
if CONF.fatal_exception_format_errors:
|
||||
raise exc_info[0], exc_info[1], exc_info[2]
|
||||
six.reraise(*exc_info)
|
||||
# at least get the core message out if something happened
|
||||
message = self.message
|
||||
elif isinstance(message, Exception):
|
||||
|
@ -31,6 +31,7 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
from six.moves import urllib
|
||||
|
||||
from cinder import exception
|
||||
@ -480,14 +481,14 @@ def _reraise_translated_image_exception(image_id):
|
||||
"""Transform the exception for the image but keep its traceback intact."""
|
||||
_exc_type, exc_value, exc_trace = sys.exc_info()
|
||||
new_exc = _translate_image_exception(image_id, exc_value)
|
||||
raise new_exc, None, exc_trace
|
||||
six.reraise(new_exc, None, exc_trace)
|
||||
|
||||
|
||||
def _reraise_translated_exception():
|
||||
"""Transform the exception but keep its traceback intact."""
|
||||
_exc_type, exc_value, exc_trace = sys.exc_info()
|
||||
new_exc = _translate_plain_exception(exc_value)
|
||||
raise new_exc, None, exc_trace
|
||||
six.reraise(new_exc, None, exc_trace)
|
||||
|
||||
|
||||
def _translate_image_exception(image_id, exc_value):
|
||||
|
@ -341,7 +341,7 @@ class NetAppBlockStorageLibrary(object):
|
||||
if lun_id is not None:
|
||||
return lun_id
|
||||
else:
|
||||
raise exc_info[0], exc_info[1], exc_info[2]
|
||||
six.reraise(*exc_info)
|
||||
|
||||
def _unmap_lun(self, path, initiator_list):
|
||||
"""Unmaps a LUN from given initiator."""
|
||||
|
@ -134,7 +134,7 @@ class Client(object):
|
||||
if e.code == '13115' or e.code == '9016':
|
||||
pass
|
||||
else:
|
||||
raise exc_info[0], exc_info[1], exc_info[2]
|
||||
six.reraise(*exc_info)
|
||||
|
||||
def create_igroup(self, igroup, igroup_type='iscsi', os_type='default'):
|
||||
"""Creates igroup with specified args."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user