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