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