瀏覽代碼

Fix "borgmatic list --successful" with a slightly better heuristic for listing successful (non-checkpoint) archives.

Dan Helfman 5 年之前
父節點
當前提交
c12c47cace
共有 4 個文件被更改,包括 17 次插入6 次删除
  1. 4 0
      NEWS
  2. 3 2
      borgmatic/borg/list.py
  3. 9 3
      docs/how-to/monitor-your-backups.md
  4. 1 1
      setup.py

+ 4 - 0
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:

+ 3 - 2
borgmatic/borg/list.py

@@ -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".
-BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[!.][!c][!h][!e][!c][!k][!p][!o][!i][!n][!t]'
+# A hack to convince Borg to exclude archives ending in ".checkpoint". This assumes that a
+# 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):

+ 9 - 3
docs/how-to/monitor-your-backups.md

@@ -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
-`--last`, you can list the last successful backup for use in your monitoring
-scripts. Here's an example combined with `--json`:
+successful (non-checkpoint) backups. This flag works via a basic heuristic: It
+assumes that non-checkpoint archive names end with a digit (e.g. from a
+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

+ 1 - 1
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(