Fix support for non-numeric scrub plans (fixes #48)
This commit is contained in:
1 parent
5524a86f7c
commit
8ce2458e5e
3 files changed
+12
-4
No files matched your search
@@ -39,13 +39,13 @@ 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
|
* Add support for scrub --plan, replacing --percentage (thanks to fmoledina)
|
||||||
* Remove snapraid progress output. Was accidentially introduced with python3
|
* Remove snapraid progress output. Was accidentially introduced with python3
|
||||||
support.
|
support.
|
||||||
|
|
||||||
### v0.5 (26 Feb 2021)
|
### v0.5 (26 Feb 2021)
|
||||||
* Remove (broken) python2 support
|
* Remove (broken) python2 support
|
||||||
* Fix snapraid output encoding handling (by hyyz17200, #31)
|
* Fix snapraid output encoding handling (by hyyz17200, #31)
|
||||||
* Fix log rotation (by ptoulouse, #36)
|
* Fix log rotation (by ptoulouse, #36)
|
||||||
|
|
||||||
### v0.4 (17 Aug 2019)
|
### v0.4 (17 Aug 2019)
|
||||||
|
|||||||
@@ -40,4 +40,5 @@ password =
|
|||||||
enabled = false
|
enabled = false
|
||||||
; scrub plan - either a percentage or one of [bad, new, full]
|
; scrub plan - either a percentage or one of [bad, new, full]
|
||||||
plan = 12
|
plan = 12
|
||||||
|
; minimum block age (in days) for scrubbing. Only used with percentage plans
|
||||||
older-than = 10
|
older-than = 10
|
||||||
+9
-2
@@ -291,10 +291,17 @@ def run():
|
|||||||
if config["scrub"]["enabled"]:
|
if config["scrub"]["enabled"]:
|
||||||
logging.info("Running scrub...")
|
logging.info("Running scrub...")
|
||||||
try:
|
try:
|
||||||
snapraid_command("scrub", {
|
# Check if a percentage plan was given
|
||||||
|
int(config["scrub"]["plan"])
|
||||||
|
except ValueError:
|
||||||
|
scrub_args = {"plan": config["scrub"]["plan"]}
|
||||||
|
else:
|
||||||
|
scrub_args = {
|
||||||
"plan": config["scrub"]["plan"],
|
"plan": config["scrub"]["plan"],
|
||||||
"older-than": config["scrub"]["older-than"],
|
"older-than": config["scrub"]["older-than"],
|
||||||
})
|
}
|
||||||
|
try:
|
||||||
|
snapraid_command("scrub", scrub_args)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
finish(False)
|
finish(False)
|
||||||
|
|||||||
Reference in new issue
Block a user