From 1b897c39ba8c0f1bf180316637cc2d87e6920800 Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Fri, 19 Feb 2016 17:08:56 +0530 Subject: tools/glusterfind: New option --no-encode New option added to skip encoding path in output file. Also handled Unicode strings. File paths can have newline characters, to differentiate between each path patch is encoded according to RFC3986(https://www.ietf.org/rfc/rfc3986.txt). Due to this consumer applications have to decode the path before consuming it. With this option Paths are not encoded, can be directly consumed by applications. Unicode encoding is handled automatically BUG: 1310080 Change-Id: I83d59831997dbd1264b48e9b1aa732c7dfc700b5 Signed-off-by: Aravinda VK Reviewed-on: http://review.gluster.org/13477 Smoke: Gluster Build System Reviewed-by: Milind Changire NetBSD-regression: NetBSD Build System Reviewed-by: Kotresh HR CentOS-regression: Gluster Build System Reviewed-by: Venky Shankar --- tools/glusterfind/src/utils.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tools/glusterfind/src/utils.py') diff --git a/tools/glusterfind/src/utils.py b/tools/glusterfind/src/utils.py index fdf61fe0f9e..b3b0bdfffa3 100644 --- a/tools/glusterfind/src/utils.py +++ b/tools/glusterfind/src/utils.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # Copyright (c) 2015 Red Hat, Inc. # This file is part of GlusterFS. @@ -228,14 +229,17 @@ def get_changelog_rollover_time(volumename): return DEFAULT_CHANGELOG_INTERVAL -def output_path_prepare(path, output_prefix): +def output_path_prepare(path, args): """ If Prefix is set, joins to Path, removes ending slash and encodes it. """ - if output_prefix != ".": - path = os.path.join(output_prefix, path) + if args.output_prefix != ".": + path = os.path.join(args.output_prefix, path) if path.endswith("/"): path = path[0:len(path)-1] - return urllib.quote_plus(path) + if args.no_encode: + return path + else: + return urllib.quote_plus(path) -- cgit