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