From e2dbf3f6db70a8fbdb475aac8a6ce6156433dfcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20=C3=9Cr=C3=BCn?= Date: Wed, 5 Jul 2023 14:56:27 +0200 Subject: [PATCH] Add overwrite flag --- controller.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/controller.py b/controller.py index 8f96edb..2aded00 100755 --- a/controller.py +++ b/controller.py @@ -505,7 +505,7 @@ def controller( goldenrun_data = {} hdf5_file = Path(hdf5path) - if hdf5_file.is_file(): + if hdf5_file.is_file() and not args.overwrite: clogger.info("HDF5 file already exits") try: [ @@ -514,7 +514,9 @@ def controller( backup_goldenrun_data, ] = read_backup(hdf5_file) except NameError: - clogger.warning("Backup could not be found in the HDF5 file") + clogger.warning( + "Backup could not be found in the HDF5 file, run with the overwrite flag to overwrite!" + ) return config_qemu except tables.NoSuchNodeError: clogger.warning( @@ -537,7 +539,9 @@ def controller( if not args.append: overwrite_faults = True else: - clogger.warning("Backup does not match, ending the execution!") + clogger.warning( + "Backup does not match, run with the overwrite flag to overwrite!" + ) return config_qemu if goldenrun: @@ -773,6 +777,13 @@ def get_argument_parser(): action="store_true", required=False, ) + parser.add_argument( + "--overwrite", + "-o", + help="Overwrite the existing file", + action="store_true", + required=False, + ) return parser