diff options
| author | Aravinda VK <avishwan@redhat.com> | 2015-03-19 17:36:52 +0530 | 
|---|---|---|
| committer | Venky Shankar <vshankar@redhat.com> | 2015-04-01 10:33:27 -0700 | 
| commit | ad0690d3bf979bf7098e718909d58399854c4560 (patch) | |
| tree | 4b0fc754a7f871e1954fde7cc930bc79fda07e70 | |
| parent | c1e1c7443a26d132b3ba6cb164f80ca934690ba6 (diff) | |
tools/glusterfind: Convert Output file path to absolute path
BUG: 1203656
Change-Id: Ie6c8f38894466246c453b2a863538a420acfe9f7
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/10011
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kotresh HR <khiremat@redhat.com>
Reviewed-by: Prashanth Pai <ppai@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Venky Shankar <vshankar@redhat.com>
| -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",  | 
