diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/glusterfind/src/main.py | 12 |
1 files changed, 10 insertions, 2 deletions
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", |