From 24b5eccefc239736fb29a2c8d475beea83a4052d Mon Sep 17 00:00:00 2001 From: Thomas LEVEIL Date: Wed, 3 Jan 2018 00:13:44 +0100 Subject: [PATCH] add support for Borg `--keep-minutely` prune option --- README.md | 2 ++ borgmatic/config/schema.yaml | 4 ++++ borgmatic/tests/integration/config/test_validate.py | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8704d3d9e..1cbfe4dd8 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ location: retention: # Retention policy for how many backups to keep in each category. + keep_minutely: 60 + keep_hourly: 24 keep_daily: 7 keep_weekly: 4 keep_monthly: 6 diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index b98967af3..fadbc4bb8 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -122,6 +122,10 @@ map: type: scalar desc: Keep all archives within this time interval. example: 3H + keep_minutely: + type: int + desc: Number of minutely archives to keep. + example: 60 keep_hourly: type: int desc: Number of hourly archives to keep. diff --git a/borgmatic/tests/integration/config/test_validate.py b/borgmatic/tests/integration/config/test_validate.py index 3892ca298..e3e169879 100644 --- a/borgmatic/tests/integration/config/test_validate.py +++ b/borgmatic/tests/integration/config/test_validate.py @@ -44,6 +44,8 @@ def test_parse_configuration_transforms_file_into_mapping(): - hostname.borg retention: + keep_minutely: 60 + keep_hourly: 24 keep_daily: 7 consistency: @@ -57,7 +59,7 @@ def test_parse_configuration_transforms_file_into_mapping(): assert result == { 'location': {'source_directories': ['/home', '/etc'], 'repositories': ['hostname.borg']}, - 'retention': {'keep_daily': 7}, + 'retention': {'keep_daily': 7, 'keep_hourly': 24, 'keep_minutely': 60}, 'consistency': {'checks': ['repository', 'archives']}, }