From ad0690d3bf979bf7098e718909d58399854c4560 Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Thu, 19 Mar 2015 17:36:52 +0530 Subject: tools/glusterfind: Convert Output file path to absolute path BUG: 1203656 Change-Id: Ie6c8f38894466246c453b2a863538a420acfe9f7 Signed-off-by: Aravinda VK Reviewed-on: http://review.gluster.org/10011 Tested-by: Gluster Build System Reviewed-by: Kotresh HR Reviewed-by: Prashanth Pai Reviewed-by: Venky Shankar Tested-by: Venky Shankar --- tools/glusterfind/src/main.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py index d6b9a24dec9..d97aafdbff1 100644 --- a/tools/glusterfind/src/main.py +++ b/tools/glusterfind/src/main.py @@ -14,7 +14,7 @@ import time from multiprocessing import Process import os import xml.etree.cElementTree as etree -from argparse import ArgumentParser, RawDescriptionHelpFormatter +from argparse import ArgumentParser, RawDescriptionHelpFormatter, Action import logging import shutil @@ -31,6 +31,14 @@ ParseError = etree.ParseError if hasattr(etree, 'ParseError') else SyntaxError logger = logging.getLogger() +class StoreAbsPath(Action): + def __init__(self, option_strings, dest, nargs=None, **kwargs): + super(StoreAbsPath, self).__init__(option_strings, dest, **kwargs) + + def __call__(self, parser, namespace, values, option_string=None): + setattr(namespace, self.dest, os.path.abspath(values)) + + def node_run(volume, host, path, start, outfile, args, fallback=False): """ If host is local node, execute the command locally. If not local @@ -237,7 +245,7 @@ def _get_args(): parser_pre = subparsers.add_parser('pre') parser_pre.add_argument("session", help="Session Name") parser_pre.add_argument("volume", help="Volume Name") - parser_pre.add_argument("outfile", help="Output File") + parser_pre.add_argument("outfile", help="Output File", action=StoreAbsPath) parser_pre.add_argument("--debug", help="Debug", action="store_true") parser_pre.add_argument("--full", help="Full find", action="store_true") parser_pre.add_argument("--change-detector", dest="change_detector", -- cgit