e3c68b
From 1354a492cbc758f9801568153380ca896fab7765 Mon Sep 17 00:00:00 2001
e3c68b
From: Sunny Kumar <sunkumar@redhat.com>
e3c68b
Date: Fri, 10 Jan 2020 14:28:35 +0000
e3c68b
Subject: [PATCH 349/349] glusterfind: python3 compatibility
e3c68b
e3c68b
Problem:
e3c68b
While we delete gluster volume the hook script 'S57glusterfind-delete-post.py'
e3c68b
is failed to execute and error message can be observed in glusterd log.
e3c68b
e3c68b
Traceback:
e3c68b
  File "/var/lib/glusterd/hooks/1/delete/post/S57glusterfind-delete-post", line 69, in <module>
e3c68b
    main()
e3c68b
  File "/var/lib/glusterd/hooks/1/delete/post/S57glusterfind-delete-post", line 39, in main
e3c68b
    glusterfind_dir = os.path.join(get_glusterd_workdir(), "glusterfind")
e3c68b
  File "/usr/lib64/python3.7/posixpath.py", line 94, in join
e3c68b
    genericpath._check_arg_types('join', a, *p)
e3c68b
  File "/usr/lib64/python3.7/genericpath.py", line 155, in _check_arg_types
e3c68b
    raise TypeError("Can't mix strings and bytes in path components") from None
e3c68b
TypeError: Can't mix strings and bytes in path components
e3c68b
e3c68b
Solution:
e3c68b
e3c68b
Added the 'universal_newlines' flag to Popen to support backward compatibility.
e3c68b
e3c68b
Backport of:
e3c68b
 > Patch: https://review.gluster.org/23994
e3c68b
 > Change-Id: Ie5655b11b55535c5ad2338108d0448e6fdaacf4f
e3c68b
 > Fixes: bz#1789478
e3c68b
 > Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
e3c68b
e3c68b
Change-Id: Ie5655b11b55535c5ad2338108d0448e6fdaacf4f
e3c68b
BUG: 1789447
e3c68b
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
e3c68b
Signed-off-by: Kotresh HR <khiremat@redhat.com>
e3c68b
Reviewed-on: https://code.engineering.redhat.com/gerrit/189216
e3c68b
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e3c68b
---
e3c68b
 tools/glusterfind/S57glusterfind-delete-post.py | 2 +-
e3c68b
 1 file changed, 1 insertion(+), 1 deletion(-)
e3c68b
e3c68b
diff --git a/tools/glusterfind/S57glusterfind-delete-post.py b/tools/glusterfind/S57glusterfind-delete-post.py
e3c68b
index 5b5142d..5beece2 100755
e3c68b
--- a/tools/glusterfind/S57glusterfind-delete-post.py
e3c68b
+++ b/tools/glusterfind/S57glusterfind-delete-post.py
e3c68b
@@ -18,7 +18,7 @@ def handle_rm_error(func, path, exc_info):
e3c68b
 
e3c68b
 def get_glusterd_workdir():
e3c68b
     p = Popen(["gluster", "system::", "getwd"],
e3c68b
-              stdout=PIPE, stderr=PIPE)
e3c68b
+              stdout=PIPE, stderr=PIPE, universal_newlines=True)
e3c68b
 
e3c68b
     out, _ = p.communicate()
e3c68b
 
e3c68b
-- 
e3c68b
1.8.3.1
e3c68b