Merge "Fix: "raise" issues for Python 2/3 compatible code."

This commit is contained in:
Zuul 2018-11-08 13:08:17 +00:00 committed by Gerrit Code Review
commit ded5fe6cbc
2 changed files with 4 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import contextlib
import logging
import sys
import traceback
import six
from sysinv.openstack.common.gettextutils import _
@ -48,4 +49,4 @@ def save_and_reraise_exception():
logging.error(_('Original exception being dropped: %s'),
traceback.format_exception(type_, value, tb))
raise
raise type_, value, tb
six.reraise(type_, value, tb)

View File

@ -26,6 +26,7 @@ import json
import time
import eventlet
import six
from sysinv.openstack.common.rpc import common as rpc_common
@ -69,7 +70,7 @@ class Consumer(object):
# Caller might have called ctxt.reply() manually
for (reply, failure) in ctxt._response:
if failure:
raise failure[0], failure[1], failure[2]
six.reraise(failure[0], failure[1], failure[2])
res.append(reply)
# if ending not 'sent'...we might have more data to
# return from the function itself