mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-08-06 16:23:00 +02:00
List the configured "when" action names in the log entries for command hooks (#1063).
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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):
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user