Skip to content

Commit

Permalink
clean up scrub arg checking code
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoledina committed Oct 30, 2021
1 parent 78f96e6 commit afb83c6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions snapraid-btrfs-runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,20 @@ def run():
logging.info("Running scrub...")
# if using new, bad, or full, ignore older-than config option
try:
int(config["scrub"]["plan"])
except ValueError:
snapraid_args_extend = {
"plan": int(config["scrub"]["plan"]),
"older-than": config["scrub"]["older-than"],
"plan": config["scrub"]["plan"],
}
except:
if config["scrub"]["older-than"] > 0:
logging.warning(
"Ignoring 'older-than' config item with scrub plan '{}'".format(
config["scrub"]["plan"]))
else:
snapraid_args_extend = {
"plan": config["scrub"]["plan"],
"older-than": config["scrub"]["older-than"],
}
logging.warning(
"Ignoring 'older-than' config item with scrub plan '{}'".format(
config["scrub"]["plan"]))
try:
snapraid_btrfs_command("scrub", snapraid_args = snapraid_args_extend, snapraid_btrfs_args = snapraid_btrfs_args_extend)
except subprocess.CalledProcessError as e:
Expand Down

0 comments on commit afb83c6

Please sign in to comment.