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

use from six import reraise as raise_
to re-implement raise

Story:2003430
Task:27478

Change-Id: I34373ce7f233f7f908da3d92bcc000a9e924375d
Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
Sun Austin 2018-10-15 17:00:21 +08:00
parent 28ad64fdbb
commit 1477d25d55
2 changed files with 4 additions and 3 deletions

View File

@ -27,7 +27,7 @@ import contextlib
import logging
import sys
import traceback
from six import reraise as raise_
from sm_api.openstack.common.gettextutils import _
@ -52,4 +52,4 @@ def save_and_reraise_exception():
logging.error(_('Original exception being dropped: %s'),
traceback.format_exception(type_, value, tb))
raise
raise type_, value, tb
raise_(type_,value,tb)

View File

@ -31,6 +31,7 @@ import time
import eventlet
from six import reraise as raise_
from sm_api.openstack.common.rpc import common as rpc_common
CONSUMERS = {}
@ -73,7 +74,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]
raise_(failure[0],failure[1],failure[2])
res.append(reply)
# if ending not 'sent'...we might have more data to
# return from the function itself