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