[Part2]: Remove the six

The six should be removed completed in https://review.opendev.org/#/c/725167/
but missing, this PS to finish it.

more info: https://github.com/benjaminp/six/blob/master/six.py#L697

Change-Id: I6b0434fd8cbd5532bc8da30031faf00b9b87fd15
This commit is contained in:
jacky06 2020-05-08 00:26:48 +08:00
parent b5150230ce
commit 397eca9232
3 changed files with 17 additions and 5 deletions

View File

@ -755,3 +755,15 @@ def is_port_active(neutron_port):
neutron client's 'show_port'
"""
return (neutron_port['status'] == n_const.PORT_STATUS_ACTIVE)
def reraise(tp, value, tb=None):
try:
if value is None:
value = tp()
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
finally:
value = None
tb = None

View File

@ -11,7 +11,6 @@
# under the License.
import contextlib
import six
import sys
import tarfile
@ -23,6 +22,7 @@ from oslo_utils import encodeutils
from zun.common import consts
from zun.common import exception
from zun.common.i18n import _
from zun.common import utils
import zun.conf
@ -46,7 +46,7 @@ def docker_client():
)
except errors.APIError as e:
desired_exc = exception.DockerError(error_msg=str(e))
six.reraise(type(desired_exc), desired_exc, sys.exc_info()[2])
utils.reraise(type(desired_exc), desired_exc, sys.exc_info()[2])
class DockerHTTPClient(docker.APIClient):

View File

@ -11,7 +11,6 @@
# under the License.
import math
import six
import sys
import time
@ -22,6 +21,7 @@ from oslo_utils import excutils
from zun.common import consts
from zun.common import exception
from zun.common.i18n import _
from zun.common import utils
import zun.conf
from zun.network import network
from zun.network import neutron
@ -317,7 +317,7 @@ class KuryrNetwork(network.Network):
raise exception.SecurityGroupCannotBeApplied(
str(e))
else:
six.reraise(*exc_info)
utils.reraise(*exc_info)
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception("Neutron Error:")
@ -350,7 +350,7 @@ class KuryrNetwork(network.Network):
raise exception.SecurityGroupCannotBeRemoved(
str(e))
else:
six.reraise(*exc_info)
utils.reraise(*exc_info)
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception("Neutron Error:")