]> git-server-git.apps.pok.os.sepia.ceph.com Git - remoto.git/commitdiff
Configure execnet to not convert Python2 str (bytes) to Python3 str (unicode)
authorOleh Prypin <oleh@pryp.in>
Mon, 6 Jun 2016 20:32:41 +0000 (23:32 +0300)
committerOleh Prypin <oleh@pryp.in>
Mon, 6 Jun 2016 20:58:42 +0000 (23:58 +0300)
Signed-off-by: Oleh Prypin <oleh@pryp.in>
remoto/connection.py
remoto/log.py

index 98cbe480b0c07cc319cfcd932ec56c018c3661e6..aba5d51bb84c35b655d446e7e9c1cdf0456387c2 100644 (file)
@@ -26,9 +26,11 @@ class Connection(object):
             self.gateway = self._make_gateway(hostname)
 
     def _make_gateway(self, hostname):
-        return execnet.makegateway(
+        gateway = execnet.makegateway(
             self._make_connection_string(hostname)
         )
+        gateway.reconfigure(py2str_as_py3str=False, py3str_as_py2str=False)
+        return gateway
 
     def _detect_sudo(self, _execnet=None):
         """
index 4284581ad29da9fb9847328e6d8745b91cef10ee..375e72a3c340e920a21bd6b0b4d02ca1b2f59c3d 100644 (file)
@@ -12,6 +12,8 @@ def reporting(conn, result, timeout=None):
         try:
             received = result.receive(timeout)
             level_received, message = list(received.items())[0]
+            if not isinstance(message, str):
+                message = message.decode('utf-8')
             log_map[level_received](message.strip('\n'))
         except EOFError:
             break