summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2015-04-28 14:40:27 +0530
committerVijay Bellur <vbellur@redhat.com>2015-05-04 02:27:26 -0700
commit20353cc323704292753ea6b7b0034362109fef76 (patch)
tree4a4e71c15ea9e878ea87a06e191a224153e0414e
parentda1416051d19d612d131acfde8589bc8658979b5 (diff)
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 <avishwan@redhat.com> BUG: 1207028 Reviewed-on: http://review.gluster.org/10418 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kotresh HR <khiremat@redhat.com>
-rw-r--r--tools/glusterfind/src/main.py9
1 files changed, 9 insertions, 0 deletions
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 <SESSION> <VOLUME>
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: