diff options
Diffstat (limited to 'oslo_rootwrap')
-rw-r--r-- | oslo_rootwrap/jsonrpc.py | 7 | ||||
-rw-r--r-- | oslo_rootwrap/tests/run_daemon.py | 1 | ||||
-rw-r--r-- | oslo_rootwrap/tests/test_rootwrap.py | 4 |
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'], |