From b6d3bc8a98a44348d851829d1930c9c662c1c88b 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 | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/controller.py b/controller.py index e4eae4e..8e0e0c7 100755 --- a/controller.py +++ b/controller.py @@ -534,7 +534,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") # backup_raw_faultlist is currently not used. # Keeping it for possible future features. @@ -564,16 +564,10 @@ def controller( if not args.append: overwrite_faults = True else: - clogger.warning("Backup does not match, running goldenrun!") - goldenrun = True - - print_fault = True - print_config = True - print_goldenrun = True - - if hdf5mode == "a": - print_config = False - print_goldenrun = False + clogger.warning( + "Backup does not match, run with overwrite flag to overwrite!" + ) + return config_qemu if goldenrun: raw_faultlist = copy.deepcopy(faultlist) @@ -811,6 +805,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