From 64588d4f6d69ce6e9b82335d12fa6c42794c38fa Mon Sep 17 00:00:00 2001 From: Milind Changire Date: Tue, 6 Jun 2017 23:43:54 +0530 Subject: tools/glusterfind: add --field-separator option Problem: Default field separator is a space character. This gets in the way if the file name itself has embedded spaces. Solution: Add --field-separator option to "pre" and "query" commands. The field separator string will be used to separate strings in the output lines that get written to the output file. eg. old output: NEW file1.txt RENAME file2 Copy.txt file3.txt with --field-separator as "===" new output: NEW===file1.txt RENAME===file2 Copy.txt===file3.txt Change-Id: I71e878fed58ba1113d97044ac9f6404ee66227c7 BUG: 1453151 Signed-off-by: Milind Changire Reviewed-on: https://review.gluster.org/17481 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Aravinda VK --- tools/glusterfind/src/brickfind.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools/glusterfind/src/brickfind.py') diff --git a/tools/glusterfind/src/brickfind.py b/tools/glusterfind/src/brickfind.py index efc840bca70..439c8816f92 100644 --- a/tools/glusterfind/src/brickfind.py +++ b/tools/glusterfind/src/brickfind.py @@ -42,7 +42,8 @@ def brickfind_crawl(brick, args): path = path.strip() path = path[brick_path_len+1:] output_write(fout, path, args.output_prefix, - encode=(not args.no_encode), tag=args.tag) + encode=(not args.no_encode), tag=args.tag, + field_separator=args.field_separator) ignore_dirs = [os.path.join(brick, dirname) for dirname in @@ -73,6 +74,8 @@ def _get_args(): action="store_true") parser.add_argument("--output-prefix", help="File prefix in output", default=".") + parser.add_argument("--field-separator", help="Field separator", + default=" ") return parser.parse_args() -- cgit