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