From 4cb7e695afbe0ed6fe66877863955c66fc726477 Mon Sep 17 00:00:00 2001 From: Chronial Date: Sat, 25 Sep 2021 22:39:22 +0200 Subject: [PATCH] Use new scrub --plan, replacing --percentage This gives us a dependency on snapraid being >= v9.0, which was released in 2015. --- README.md | 1 + snapraid-runner.conf.example | 3 ++- snapraid-runner.py | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4662bb5..a1d482d 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ feature you are missing, you can have a look ## Changelog ### Unreleased * Add --ignore-deletethreshold (by exterrestris, #25) +* Add support for scrub --plan, replacing --percentage ### v0.5 (26 Feb 2021) * Remove (broken) python2 support diff --git a/snapraid-runner.conf.example b/snapraid-runner.conf.example index ed64810..14f2e20 100644 --- a/snapraid-runner.conf.example +++ b/snapraid-runner.conf.example @@ -38,5 +38,6 @@ password = [scrub] ; set to true to run scrub after sync enabled = false -percentage = 12 +; scrub plan - either a percentage or one of [bad, new, full] +plan = 12 older-than = 10 diff --git a/snapraid-runner.py b/snapraid-runner.py index 8e013ae..f123099 100644 --- a/snapraid-runner.py +++ b/snapraid-runner.py @@ -148,7 +148,7 @@ def load_config(args): int_options = [ ("snapraid", "deletethreshold"), ("logging", "maxsize"), - ("scrub", "percentage"), ("scrub", "older-than"), ("email", "maxsize"), + ("scrub", "older-than"), ("email", "maxsize"), ] for section, option in int_options: try: @@ -162,6 +162,10 @@ def load_config(args): config["email"]["short"] = (config["email"]["short"].lower() == "true") config["snapraid"]["touch"] = (config["snapraid"]["touch"].lower() == "true") + # Migration + if config["scrub"]["percentage"]: + config["scrub"]["plan"] = config["scrub"]["percentage"] + if args.scrub is not None: config["scrub"]["enabled"] = args.scrub @@ -295,7 +299,7 @@ def run(): logging.info("Running scrub...") try: snapraid_command("scrub", { - "percentage": config["scrub"]["percentage"], + "plan": config["scrub"]["plan"], "older-than": config["scrub"]["older-than"], }) except subprocess.CalledProcessError as e: