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