14 Commits

Author SHA1 Message Date
429a4a6712 Hilarious oversights 2023-03-26 03:38:27 -07:00
acfbb90f91 hooks? 2023-03-26 02:26:02 -07:00
9f26c09453 hooks? 2023-03-26 02:25:56 -07:00
248f759d96 hooks? 2023-03-26 02:25:27 -07:00
0125e92a0a hooks? 2023-03-26 02:24:20 -07:00
a59c573174 hooks? 2023-03-26 02:24:05 -07:00
b3687abb62 hooks? 2023-03-26 02:23:07 -07:00
91b2b0d98a hooks? 2023-03-26 02:22:15 -07:00
cf9be50c2a hooks? 2023-03-26 02:21:58 -07:00
5ffe16cd31 hooks? 2023-03-26 02:20:39 -07:00
8e03950102 Bump python version 2023-03-26 02:17:04 -07:00
9aa66d8e50 Bump python version to 3.10 because old one was segfaulting 2022-07-15 03:26:00 -07:00
cfccf4aa70 Uhm specify a pyenv version? 2022-07-10 06:30:55 -07:00
e704930c71 Re-lock pipenv using more specific python version 2022-07-10 06:30:33 -07:00
5 changed files with 29 additions and 4 deletions

1
.python-version Normal file
View File

@ -0,0 +1 @@
3.10.10

View File

@ -149,6 +149,7 @@ class BackupRotator:
self.log("Path only has {} items, which does not meet the minimum threshold of {} items. Won't rotate this path.".format( self.log("Path only has {} items, which does not meet the minimum threshold of {} items. Won't rotate this path.".format(
len(children), minimum_items len(children), minimum_items
)) ))
return
elif len(children) <= max_items: elif len(children) <= max_items:
self.log("Path only has {} items, but needs more than {} for rotation; Won't rotate this path.".format( self.log("Path only has {} items, but needs more than {} for rotation; Won't rotate this path.".format(
len(children), max_items len(children), max_items
@ -195,6 +196,14 @@ class BackupRotator:
self.log("Rotating path for max age of {} days: {}".format(max_age_days, path)) self.log("Rotating path for max age of {} days: {}".format(max_age_days, path))
children = self._gather_rotation_candidates(config, path) children = self._gather_rotation_candidates(config, path)
minimum_items = self._determine_minimum_items(config)
# Do we need to rotate anything out?
if len(children) < minimum_items:
self.log("Path only has {} items, which does not meet the minimum threshold of {} items. Won't rotate this path.".format(
len(children), minimum_items
))
return
self.log("Examining {} items for deletion".format(len(children))) self.log("Examining {} items for deletion".format(len(children)))
children_to_delete = [] children_to_delete = []

View File

@ -9,5 +9,6 @@ pyyaml = ">=5.4"
[dev-packages] [dev-packages]
[requires] [requires]
python_version = "3" python_version = "3.10.10"

4
Pipfile.lock generated
View File

@ -1,11 +1,11 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "ac6a3bf65ec43902d7a8907c3b0ae70e365127a1f93ecf12080f847eadb7dc35" "sha256": "cceb18d3baeb19edef3ba31b743720003102c4c3d9cddd6b595c664692a37384"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
"python_version": "3" "python_version": "3.10.5"
}, },
"sources": [ "sources": [
{ {

View File

@ -78,11 +78,25 @@ Specifies the method used when attempting to determine how old a backup file/dir
Currently, only *file* is supported Currently, only *file* is supported
### minimum-items < INTEGER >
Specifies the minimum number of backup files/dirs that must be present before rotating can happen. Should be an integer.
This option doesn't specify how much to rotate on its own, but when rotation is possible. It should probably be used with maximum-age or something other than maximum-items.
For example, when the *minimum-items* value is set to 5, and *target-type* is *file*, the program will not rotate any files until there are at least 5 in the target directory.
### maximum-items < INTEGER > ### maximum-items < INTEGER >
Specifies the maximum number of backup files/dirs that are allowed in a path before rotating will happen. Should be an integer. Specifies the maximum number of backup files/dirs that are allowed in a path before rotating will happen. Should be an integer.
For example, when the *maximum-items* value is set to 5, and *target-type* is *file*, the program will not rotate any files until there are at least 5 in the target directory. For example, when the *maximum-items* value is set to 500, and *target-type* is *file*, the program will not rotate any files until there are at least 500 in the target directory.
### maximum-age < INTEGER >
Specifies the maximum age (in days) of backup files/dirs that are allowed in a path before rotating will happen. Should be an integer.
For example, when the *maximum-age* value is set to 30, and *target-type* is *file*, the program will not rotate any files that are newer than 30 days.
### paths < Array of Paths > ### paths < Array of Paths >