14f8ab
From 4a04e1b5540921db22f1894f71eb30342127192d Mon Sep 17 00:00:00 2001
14f8ab
From: Kotresh HR <khiremat@redhat.com>
14f8ab
Date: Tue, 12 Nov 2019 21:53:20 +0530
14f8ab
Subject: [PATCH 315/316] geo-rep: Fix py2/py3 compatibility in repce
14f8ab
14f8ab
Geo-rep fails to start on python2 only machine like
14f8ab
centos6. It fails with "ImportError no module named _io".
14f8ab
This patch fixes the same.
14f8ab
14f8ab
Backport of:
14f8ab
 > Patch: https://review.gluster.org/23702
14f8ab
 > fixes: bz#1771577
14f8ab
 > Change-Id: I8228458a853a230546f9faf29a0e9e0f23b3efec
14f8ab
 > Signed-off-by: Kotresh HR <khiremat@redhat.com>
14f8ab
14f8ab
BUG: 1771524
14f8ab
Change-Id: I8228458a853a230546f9faf29a0e9e0f23b3efec
14f8ab
Signed-off-by: Kotresh HR <khiremat@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/185377
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Sunny Kumar <sunkumar@redhat.com>
14f8ab
---
14f8ab
 geo-replication/syncdaemon/repce.py | 5 ++---
14f8ab
 1 file changed, 2 insertions(+), 3 deletions(-)
14f8ab
14f8ab
diff --git a/geo-replication/syncdaemon/repce.py b/geo-replication/syncdaemon/repce.py
14f8ab
index 6065b82..c622afa 100644
14f8ab
--- a/geo-replication/syncdaemon/repce.py
14f8ab
+++ b/geo-replication/syncdaemon/repce.py
14f8ab
@@ -8,7 +8,6 @@
14f8ab
 # cases as published by the Free Software Foundation.
14f8ab
 #
14f8ab
 
14f8ab
-import _io
14f8ab
 import os
14f8ab
 import sys
14f8ab
 import time
14f8ab
@@ -58,9 +57,9 @@ def recv(inf):
14f8ab
     """load an object from input stream
14f8ab
     python2 and python3 compatibility, inf is sys.stdin
14f8ab
     and is opened as text stream by default. Hence using the
14f8ab
-    buffer attribute
14f8ab
+    buffer attribute in python3
14f8ab
     """
14f8ab
-    if isinstance(inf, _io.TextIOWrapper):
14f8ab
+    if hasattr(inf, "buffer"):
14f8ab
         return pickle.load(inf.buffer)
14f8ab
     else:
14f8ab
         return pickle.load(inf)
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab