Skip to content

Commit

Permalink
Use new scrub --plan, replacing --percentage
Browse files Browse the repository at this point in the history
This gives us a dependency on snapraid being >= v9.0, which was released
in 2015.
  • Loading branch information
Chronial committed Sep 25, 2021
1 parent 11affad commit 4cb7e69
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion snapraid-runner.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 6 additions & 2 deletions snapraid-runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4cb7e69

Please sign in to comment.