Fix "borgmatic list --successful" with a slightly better heuristic for listing successful (non-checkpoint) archives.
This commit is contained in:
parent
d6aaab8a09
commit
c12c47cace
4 changed files with 17 additions and 6 deletions
4
NEWS
4
NEWS
|
@ -1,3 +1,7 @@
|
||||||
|
1.3.26
|
||||||
|
* #224: Fix "borgmatic list --successful" with a slightly better heuristic for listing successful
|
||||||
|
(non-checkpoint) archives.
|
||||||
|
|
||||||
1.3.25
|
1.3.25
|
||||||
* #223: Dead man's switch to detect when backups start failing silently, implemented via
|
* #223: Dead man's switch to detect when backups start failing silently, implemented via
|
||||||
healthchecks.io hook integration. See the documentation for more information:
|
healthchecks.io hook integration. See the documentation for more information:
|
||||||
|
|
|
@ -6,8 +6,9 @@ from borgmatic.execute import execute_command
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# A hack to convince Borg to exclude archives ending in ".checkpoint".
|
# A hack to convince Borg to exclude archives ending in ".checkpoint". This assumes that a
|
||||||
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[!.][!c][!h][!e][!c][!k][!p][!o][!i][!n][!t]'
|
# non-checkpoint archive name ends in a digit (e.g. from a timestamp).
|
||||||
|
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[0123456789]'
|
||||||
|
|
||||||
|
|
||||||
def list_archives(repository, storage_config, list_arguments, local_path='borg', remote_path=None):
|
def list_archives(repository, storage_config, list_arguments, local_path='borg', remote_path=None):
|
||||||
|
|
|
@ -129,9 +129,15 @@ output only shows up at the console, and not in syslog.
|
||||||
### Successful backups
|
### Successful backups
|
||||||
|
|
||||||
`borgmatic list` includes support for a `--successful` flag that only lists
|
`borgmatic list` includes support for a `--successful` flag that only lists
|
||||||
successful (non-checkpoint) backups. Combined with a built-in Borg flag like
|
successful (non-checkpoint) backups. This flag works via a basic heuristic: It
|
||||||
`--last`, you can list the last successful backup for use in your monitoring
|
assumes that non-checkpoint archive names end with a digit (e.g. from a
|
||||||
scripts. Here's an example combined with `--json`:
|
timestamp), while checkpoint archive names do not. This means that if you're
|
||||||
|
using custom archive names that do not end in a digit, the `--successful` flag
|
||||||
|
will not work as expected.
|
||||||
|
|
||||||
|
Combined with a built-in Borg flag like `--last`, you can list the last
|
||||||
|
successful backup for use in your monitoring scripts. Here's an example
|
||||||
|
combined with `--json`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
borgmatic list --successful --last 1 --json
|
borgmatic list --successful --last 1 --json
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -1,6 +1,6 @@
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
VERSION = '1.3.25'
|
VERSION = '1.3.26'
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
Loading…
Reference in a new issue