summaryrefslogtreecommitdiff
path: root/oslo_rootwrap
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.com>2020-04-02 15:01:37 +0200
committerAndreas Jaeger <aj@suse.com>2020-04-02 15:05:26 +0200
commit4445f3296b39b37229cdb7cd152ea06478a13d61 (patch)
treeb3cc14ca04fdba154c9e3ab53d856f82c45aa8d6 /oslo_rootwrap
parentfd21b6e096ea2ef718101c62b0e341db0199b5b7 (diff)
downloadoslo-rootwrap-4445f3296b39b37229cdb7cd152ea06478a13d61.tar.gz
Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix problems found. Remove hacking and friends from lower-constraints, they are not needed for installation. Change-Id: If75153300f07e6d1c5bf433af35a0dd4d98e6c7f
Diffstat (limited to 'oslo_rootwrap')
-rw-r--r--oslo_rootwrap/jsonrpc.py7
-rw-r--r--oslo_rootwrap/tests/run_daemon.py1
-rw-r--r--oslo_rootwrap/tests/test_rootwrap.py4
3 files changed, 7 insertions, 5 deletions
diff --git a/oslo_rootwrap/jsonrpc.py b/oslo_rootwrap/jsonrpc.py
index 9dd0641..195febb 100644
--- a/oslo_rootwrap/jsonrpc.py
+++ b/oslo_rootwrap/jsonrpc.py
@@ -96,6 +96,7 @@ class JsonListener(object):
def get_accepted(self):
return self._accepted
+
if hasattr(managers.Server, 'accepter'):
# In Python 3 accepter() thread has infinite loop. We break it with
# EOFError, so we should silence this error here.
@@ -118,10 +119,10 @@ class JsonConnection(object):
self._socket.sendall(s)
def recv_bytes(self, maxsize=None):
- l = struct.unpack('!Q', self.recvall(8))[0]
- if maxsize is not None and l > maxsize:
+ item = struct.unpack('!Q', self.recvall(8))[0]
+ if maxsize is not None and item > maxsize:
raise RuntimeError("Too big message received")
- s = self.recvall(l)
+ s = self.recvall(item)
return s
def send(self, obj):
diff --git a/oslo_rootwrap/tests/run_daemon.py b/oslo_rootwrap/tests/run_daemon.py
index 8483ff1..a39e4cf 100644
--- a/oslo_rootwrap/tests/run_daemon.py
+++ b/oslo_rootwrap/tests/run_daemon.py
@@ -49,6 +49,7 @@ class nonclosing(object):
def close(self):
pass
+
log_format = ("%(asctime)s | [%(process)5s]+%(levelname)5s | "
"%(message)s")
if __name__ == '__main__':
diff --git a/oslo_rootwrap/tests/test_rootwrap.py b/oslo_rootwrap/tests/test_rootwrap.py
index 112843e..d5a8c0a 100644
--- a/oslo_rootwrap/tests/test_rootwrap.py
+++ b/oslo_rootwrap/tests/test_rootwrap.py
@@ -398,7 +398,7 @@ class RootwrapTestCase(testtools.TestCase):
def test_ChainingRegExpFilter_match(self):
filter_list = [filters.ChainingRegExpFilter('nice', 'root',
- 'nice', '-?\d+'),
+ 'nice', r'-?\d+'),
filters.CommandFilter('cat', 'root')]
args = ['nice', '5', 'cat', '/a']
dirs = ['/bin', '/usr/bin']
@@ -407,7 +407,7 @@ class RootwrapTestCase(testtools.TestCase):
def test_ChainingRegExpFilter_not_match(self):
filter_list = [filters.ChainingRegExpFilter('nice', 'root',
- 'nice', '-?\d+'),
+ 'nice', r'-?\d+'),
filters.CommandFilter('cat', 'root')]
args_invalid = (['nice', '5', 'ls', '/a'],
['nice', '--5', 'cat', '/a'],