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:
1 parent
11affad8b7
commit
4cb7e695af
3 files changed
+9
-3
No files matched your search
@@ -39,6 +39,7 @@ feature you are missing, you can have a look
|
|||||||
## Changelog
|
## Changelog
|
||||||
### Unreleased
|
### Unreleased
|
||||||
* Add --ignore-deletethreshold (by exterrestris, #25)
|
* Add --ignore-deletethreshold (by exterrestris, #25)
|
||||||
|
* Add support for scrub --plan, replacing --percentage
|
||||||
|
|
||||||
### v0.5 (26 Feb 2021)
|
### v0.5 (26 Feb 2021)
|
||||||
* Remove (broken) python2 support
|
* Remove (broken) python2 support
|
||||||
|
|||||||
@@ -38,5 +38,6 @@ password =
|
|||||||
[scrub]
|
[scrub]
|
||||||
; set to true to run scrub after sync
|
; set to true to run scrub after sync
|
||||||
enabled = false
|
enabled = false
|
||||||
percentage = 12
|
; scrub plan - either a percentage or one of [bad, new, full]
|
||||||
|
plan = 12
|
||||||
older-than = 10
|
older-than = 10
|
||||||
+6
-2
@@ -148,7 +148,7 @@ def load_config(args):
|
|||||||
|
|
||||||
int_options = [
|
int_options = [
|
||||||
("snapraid", "deletethreshold"), ("logging", "maxsize"),
|
("snapraid", "deletethreshold"), ("logging", "maxsize"),
|
||||||
("scrub", "percentage"), ("scrub", "older-than"), ("email", "maxsize"),
|
("scrub", "older-than"), ("email", "maxsize"),
|
||||||
]
|
]
|
||||||
for section, option in int_options:
|
for section, option in int_options:
|
||||||
try:
|
try:
|
||||||
@@ -162,6 +162,10 @@ def load_config(args):
|
|||||||
config["email"]["short"] = (config["email"]["short"].lower() == "true")
|
config["email"]["short"] = (config["email"]["short"].lower() == "true")
|
||||||
config["snapraid"]["touch"] = (config["snapraid"]["touch"].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:
|
if args.scrub is not None:
|
||||||
config["scrub"]["enabled"] = args.scrub
|
config["scrub"]["enabled"] = args.scrub
|
||||||
|
|
||||||
@@ -295,7 +299,7 @@ def run():
|
|||||||
logging.info("Running scrub...")
|
logging.info("Running scrub...")
|
||||||
try:
|
try:
|
||||||
snapraid_command("scrub", {
|
snapraid_command("scrub", {
|
||||||
"percentage": config["scrub"]["percentage"],
|
"plan": config["scrub"]["plan"],
|
||||||
"older-than": config["scrub"]["older-than"],
|
"older-than": config["scrub"]["older-than"],
|
||||||
})
|
})
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
|||||||
Reference in new issue
Block a user