9f5ccc
From d7b84014cbb19e65dfae6248af47cc23fabc64e5 Mon Sep 17 00:00:00 2001
9f5ccc
From: Sunny Kumar <sunkumar@redhat.com>
9f5ccc
Date: Wed, 22 Apr 2020 15:09:16 +0100
9f5ccc
Subject: [PATCH 366/367] snapshot: fix python3 issue in gcron
9f5ccc
9f5ccc
`$gcron.py test_vol Job`
9f5ccc
Traceback:
9f5ccc
  File "/usr/sbin/gcron.py", line 189, in <module>
9f5ccc
    main()
9f5ccc
  File "/usr/sbin/gcron.py", line 121, in main
9f5ccc
    initLogger(script_name)
9f5ccc
  File "/usr/sbin/gcron.py", line 44, in initLogger
9f5ccc
    logfile = os.path.join(out.strip(), script_name[:-3]+".log")
9f5ccc
  File "/usr/lib64/python3.6/posixpath.py", line 94, in join
9f5ccc
    genericpath._check_arg_types('join', a, *p)
9f5ccc
  File "/usr/lib64/python3.6/genericpath.py", line 151, in _check_arg_types
9f5ccc
    raise TypeError("Can't mix strings and bytes in path components") from None
9f5ccc
TypeError: Can't mix strings and bytes in path components
9f5ccc
9f5ccc
Solution: Added the 'universal_newlines' flag to Popen.
9f5ccc
9f5ccc
Backport of:
9f5ccc
9f5ccc
   >Upstream Patch: https://review.gluster.org/#/c/glusterfs/+/24364/
9f5ccc
   >Change-Id: I4c7a0e5bce605e4c134f6786c9dd8162b89fc77f
9f5ccc
   >Fixes: #1193
9f5ccc
   >Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
9f5ccc
9f5ccc
BUG: 1825195
9f5ccc
Change-Id: I4c7a0e5bce605e4c134f6786c9dd8162b89fc77f
9f5ccc
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
9f5ccc
Reviewed-on: https://code.engineering.redhat.com/gerrit/198641
9f5ccc
Tested-by: RHGS Build Bot <nigelb@redhat.com>
9f5ccc
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
9f5ccc
---
9f5ccc
 extras/snap_scheduler/gcron.py | 3 ++-
9f5ccc
 1 file changed, 2 insertions(+), 1 deletion(-)
9f5ccc
9f5ccc
diff --git a/extras/snap_scheduler/gcron.py b/extras/snap_scheduler/gcron.py
9f5ccc
index 1127be0..cc16310 100755
9f5ccc
--- a/extras/snap_scheduler/gcron.py
9f5ccc
+++ b/extras/snap_scheduler/gcron.py
9f5ccc
@@ -38,7 +38,8 @@ def initLogger(script_name):
9f5ccc
     sh.setFormatter(formatter)
9f5ccc
 
9f5ccc
     process = subprocess.Popen(["gluster", "--print-logdir"],
9f5ccc
-                               stdout=subprocess.PIPE)
9f5ccc
+                               stdout=subprocess.PIPE,
9f5ccc
+                               universal_newlines=True)
9f5ccc
     out, err = process.communicate()
9f5ccc
     if process.returncode == 0:
9f5ccc
         logfile = os.path.join(out.strip(), script_name[:-3]+".log")
9f5ccc
-- 
9f5ccc
1.8.3.1
9f5ccc