14f8ab
From bfb64a0e685eb5755ceda6c54690335564e135c9 Mon Sep 17 00:00:00 2001
14f8ab
From: Hari Gowtham <hgowtham@redhat.com>
14f8ab
Date: Mon, 16 Sep 2019 14:22:34 +0530
14f8ab
Subject: [PATCH 296/297] glusterfind: pre command failure on a modify
14f8ab
14f8ab
Label: DOWNSTREAM ONLY
14f8ab
14f8ab
On upstream we have gfid_to_all_paths_using_gfid2path instead of
14f8ab
gfid_to_path_using_pgfid and so we do not hit this in upstream.
14f8ab
14f8ab
Problem: On a modify, the pre commands runs through the find function.
14f8ab
where the number of arguments sent mismatches and causes a stderr.
14f8ab
The mismatch is because of both changelog and brickfind use the find(),
14f8ab
but the brickfind was alone handled.
14f8ab
14f8ab
Fix: Have handled the additional argument on the changelog side as well.
14f8ab
Received it as a dummy variable for changelog.
14f8ab
14f8ab
Change-Id: I5eecdd993e477b68a0e486db2ad7e56ba94bbf02
14f8ab
fixes: bz#1733970
14f8ab
Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/181095
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Aravinda Vishwanathapura Krishna Murthy <avishwan@redhat.com>
14f8ab
Reviewed-by: Rinku Kothiya <rkothiya@redhat.com>
14f8ab
---
14f8ab
 tools/glusterfind/src/changelog.py | 5 +++--
14f8ab
 tools/glusterfind/src/utils.py     | 2 +-
14f8ab
 2 files changed, 4 insertions(+), 3 deletions(-)
14f8ab
14f8ab
diff --git a/tools/glusterfind/src/changelog.py b/tools/glusterfind/src/changelog.py
14f8ab
index 40c381b..ef982db 100644
14f8ab
--- a/tools/glusterfind/src/changelog.py
14f8ab
+++ b/tools/glusterfind/src/changelog.py
14f8ab
@@ -141,8 +141,9 @@ def gfid_to_path_using_pgfid(brick, changelog_data, args):
14f8ab
 
14f8ab
     # Length of brick path, to remove from output path
14f8ab
     brick_path_len = len(brick)
14f8ab
-
14f8ab
-    def output_callback(path, inode):
14f8ab
+    # is_dir is a dummy variable to make it compitable with the find
14f8ab
+    # used in brickfind
14f8ab
+    def output_callback(path, inode, is_dir):
14f8ab
         # For each path found, encodes it and updates path1
14f8ab
         # Also updates converted flag in inodegfid table as 1
14f8ab
         path = path.strip()
14f8ab
diff --git a/tools/glusterfind/src/utils.py b/tools/glusterfind/src/utils.py
14f8ab
index cc09903..e226c5a 100644
14f8ab
--- a/tools/glusterfind/src/utils.py
14f8ab
+++ b/tools/glusterfind/src/utils.py
14f8ab
@@ -70,7 +70,7 @@ def find(path, callback_func=lambda x: True, filter_func=lambda x: True,
14f8ab
             else:
14f8ab
                 filter_result = filter_func(full_path)
14f8ab
                 if filter_result is not None:
14f8ab
-                    callback_func(full_path, filter_result)
14f8ab
+                    callback_func(full_path, filter_result, None)
14f8ab
         else:
14f8ab
             filter_result = filter_func(full_path)
14f8ab
             if filter_result is not None:
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab