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