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