Skip to content

Commit

Permalink
Add overwrite flag
Browse files Browse the repository at this point in the history
  • Loading branch information
berkayurun committed Jul 5, 2023
1 parent 7ded091 commit 2f052f8
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 2f052f8

Please sign in to comment.