diff --git a/oslo_privsep/comm.py b/oslo_privsep/comm.py index c609a87..69b5b8f 100644 --- a/oslo_privsep/comm.py +++ b/oslo_privsep/comm.py @@ -28,7 +28,6 @@ import sys import threading import msgpack -import six from oslo_privsep._i18n import _ from oslo_utils import uuidutils @@ -67,7 +66,7 @@ class Serializer(object): self.writesock.shutdown(socket.SHUT_WR) -class Deserializer(six.Iterator): +class Deserializer(object): def __init__(self, readsock): self.readsock = readsock self.unpacker = msgpack.Unpacker(use_list=False, raw=False, @@ -202,7 +201,7 @@ class ClientChannel(object): self.reader_thread.join() -class ServerChannel(six.Iterator): +class ServerChannel(object): """Server-side twin to ClientChannel""" def __init__(self, sock): diff --git a/oslo_privsep/daemon.py b/oslo_privsep/daemon.py index 8bb20d1..799f493 100644 --- a/oslo_privsep/daemon.py +++ b/oslo_privsep/daemon.py @@ -62,7 +62,6 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_utils import encodeutils from oslo_utils import importutils -import six from oslo_privsep._i18n import _ from oslo_privsep import capabilities @@ -513,8 +512,8 @@ class Daemon(object): reply = (comm.Message.ERR.value, cls_name, e.args) try: channel.send((msgid, reply)) - except IOError: - self.communication_error = sys.exc_info() + except IOError as exc: + self.communication_error = exc return _call_back @@ -529,10 +528,10 @@ class Daemon(object): for msgid, msg in self.channel: error = self.communication_error if error: - if error[1].errno == errno.EPIPE: + if error.errno == errno.EPIPE: # Write stream closed, exit loop break - six.reraise(*error) + raise error # Submit the command for execution future = self.thread_pool.submit(self._process_cmd, msgid, *msg) diff --git a/oslo_privsep/tests/test_comm.py b/oslo_privsep/tests/test_comm.py index 09092e4..3978bff 100644 --- a/oslo_privsep/tests/test_comm.py +++ b/oslo_privsep/tests/test_comm.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import six +import io from oslotest import base @@ -22,7 +22,7 @@ from oslo_privsep import comm class BufSock(object): def __init__(self): self.readpos = 0 - self.buf = six.BytesIO() + self.buf = io.BytesIO() def recv(self, bufsize): if self.buf.closed: diff --git a/oslo_privsep/tests/test_daemon.py b/oslo_privsep/tests/test_daemon.py index cdde642..5a5b51e 100644 --- a/oslo_privsep/tests/test_daemon.py +++ b/oslo_privsep/tests/test_daemon.py @@ -25,7 +25,6 @@ from unittest import mock from oslo_log import formatters from oslo_log import log as logging from oslotest import base -import six import testtools from oslo_privsep import capabilities @@ -198,12 +197,12 @@ class WithContextTest(testctx.TestContextTestCase): class ClientChannelTestCase(base.BaseTestCase): DICT = { - 'string_1': ('tuple_1', six.b('tuple_2')), - six.b('byte_1'): ['list_1', 'list_2'], + 'string_1': ('tuple_1', b'tuple_2'), + b'byte_1': ['list_1', 'list_2'], } EXPECTED = { - 'string_1': ('tuple_1', six.b('tuple_2')), + 'string_1': ('tuple_1', b'tuple_2'), 'byte_1': ['list_1', 'list_2'], }