Use new scrub --plan, replacing --percentage

This gives us a dependency on snapraid being >= v9.0, which was released
in 2015.
This commit is contained in:
Chronial committed 2021-09-25 22:42:58 +02:00
1 parent 11affad8b7
commit 4cb7e695af
3 files changed
+9 -3

No files matched your search

+1
View File
@@ -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
+2 -1
View File
@@ -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
+6 -2
View File
@@ -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: