List the configured "when" action names in the log entries for command hooks (#1063).

This commit is contained in:
Dan Helfman
2025-04-08 12:04:10 -07:00
parent 2c8dc5858f
commit 7de1c2121c
3 changed files with 6 additions and 4 deletions
+1
View File
@@ -8,6 +8,7 @@
executed (implicitly or explicitly).
* #1060: Don't run action command hooks for actions listed in the "skip_actions" option.
* #1062: Fix a regression that broke environment variable interpolation.
* #1063: List the configured "when" action names in the log entries for command hooks.
2.0.1
* #1057: Fix argument parsing to avoid using Python 3.12+ string features. Now borgmatic will
+5 -2
View File
@@ -82,11 +82,14 @@ def execute_hooks(command_hooks, umask, working_directory, dry_run, **context):
for hook_config in command_hooks:
commands = hook_config.get('run')
when_description = (
f"{'/'.join(hook_config.get('when'))} " if hook_config.get('when') else ''
)
if 'before' in hook_config:
description = f'before {hook_config.get("before")}'
description = f'before {when_description}{hook_config.get("before")}'
elif 'after' in hook_config:
description = f'after {hook_config.get("after")}'
description = f'after {when_description}{hook_config.get("after")}'
else:
raise ValueError(f'Invalid hook configuration: {hook_config}')
@@ -5,8 +5,6 @@ import subprocess
import sys
import tempfile
import pytest
def generate_configuration(config_path, repository_path):
'''