Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
429a4a6712 | |||
acfbb90f91 | |||
9f26c09453 | |||
248f759d96 | |||
0125e92a0a | |||
a59c573174 | |||
b3687abb62 | |||
91b2b0d98a | |||
cf9be50c2a | |||
5ffe16cd31 | |||
8e03950102 |
@ -1 +1 @@
|
||||
3.10.5
|
||||
3.10.10
|
||||
|
@ -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(
|
||||
len(children), minimum_items
|
||||
))
|
||||
return
|
||||
elif len(children) <= max_items:
|
||||
self.log("Path only has {} items, but needs more than {} for rotation; Won't rotate this path.".format(
|
||||
len(children), max_items
|
||||
@ -195,6 +196,14 @@ class BackupRotator:
|
||||
self.log("Rotating path for max age of {} days: {}".format(max_age_days, 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)))
|
||||
children_to_delete = []
|
||||
|
2
Pipfile
2
Pipfile
@ -9,6 +9,6 @@ pyyaml = ">=5.4"
|
||||
[dev-packages]
|
||||
|
||||
[requires]
|
||||
python_version = "3.10.5"
|
||||
python_version = "3.10.10"
|
||||
|
||||
|
||||
|
16
README.md
16
README.md
@ -78,11 +78,25 @@ Specifies the method used when attempting to determine how old a backup file/dir
|
||||
|
||||
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 >
|
||||
|
||||
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 >
|
||||
|
||||
|
Reference in New Issue
Block a user