summaryrefslogtreecommitdiffstats
path: root/tools/glusterfind/src/utils.py
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2015-11-28 14:56:02 +0530
committerAravinda VK <avishwan@redhat.com>2016-04-04 23:49:50 -0700
commitf2be482914f1bc4a653a342f03fc7826ce97ae22 (patch)
tree35c14a703630aed3ee4669797a98fbc8dff95941 /tools/glusterfind/src/utils.py
parent76ed61bb5e3fefb3e4071a24f6dd26f37c950c77 (diff)
tools/glusterfind: add --full option to query command
The --full option will use brickfind.py to list all files in the volume. The output file will contain url-encoded file names prefixed with the tag string to indicate that all files should be considered as new. The default tag string for the --full option is "NEW". This can be changed with the --tag-for-full-find command-line option. Change-Id: Ic85ba5db062e19df13ae9dc2de8a08eacb5c9792 BUG: 1286280 Signed-off-by: Milind Changire <mchangir@redhat.com> Reviewed-on: http://review.gluster.org/12779 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Aravinda VK <avishwan@redhat.com> (cherry picked from commit 16a3f0d020d23978b22a07354c25c654c88163a2) Reviewed-on: http://review.gluster.org/13864
Diffstat (limited to 'tools/glusterfind/src/utils.py')
-rw-r--r--tools/glusterfind/src/utils.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/glusterfind/src/utils.py b/tools/glusterfind/src/utils.py
index b05f08ee5f6..598cc9e7f46 100644
--- a/tools/glusterfind/src/utils.py
+++ b/tools/glusterfind/src/utils.py
@@ -75,7 +75,7 @@ def find(path, callback_func=lambda x: True, filter_func=lambda x: True,
callback_func(full_path, filter_result)
-def output_write(f, path, prefix=".", encode=False):
+def output_write(f, path, prefix=".", encode=False, tag=""):
if path == "":
return
@@ -85,7 +85,10 @@ def output_write(f, path, prefix=".", encode=False):
if encode:
path = urllib.quote_plus(path)
- f.write("%s\n" % path)
+ # set the field separator
+ FS = "" if tag == "" else " "
+
+ f.write("%s%s%s\n" % (tag.strip(), FS, path))
def human_time(ts):