From 0dea37dd6da379d9c11e6291d187194399b36485 Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Tue, 28 Apr 2015 14:40:27 +0530 Subject: tools/glusterfind: New option to pre --regenerate-outfile When pre command is run twice, it overwrites the outfile. Now pre command will fail when executed twice. To force the regeneration use --regenerate-outfile Change-Id: I0cf7a139522812ece4decdfbcba667a05ce5c35e Signed-off-by: Aravinda VK BUG: 1218166 Reviewed-by: Kotresh HR Reviewed-on: http://review.gluster.org/10418 Reviewed-on: http://review.gluster.org/10522 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tools/glusterfind/src/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tools/glusterfind/src') diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py index 22d421035ff..ceaf1173897 100644 --- a/tools/glusterfind/src/main.py +++ b/tools/glusterfind/src/main.py @@ -264,6 +264,10 @@ def _get_args(): type=str, default='changelog') parser_pre.add_argument("--output-prefix", help="File prefix in output", default=".") + parser_pre.add_argument("--regenerate-outfile", + help="Regenerate outfile, discard the outfile " + "generated from last pre command", + action="store_true") # post parser_post = subparsers.add_parser('post') @@ -381,6 +385,11 @@ def mode_pre(session_dir, args): mkdirp(os.path.dirname(args.outfile), exit_on_err=True, logger=logger) + # If Pre status file exists and running pre command again + if os.path.exists(status_file_pre) and not args.regenerate_outfile: + fail("Post command is not run after last pre, " + "use --regenerate-outfile") + start = 0 try: with open(status_file) as f: -- cgit