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