replace label with repository_label

This commit is contained in:
Codimp 2024-04-29 21:16:36 +02:00
parent b67f729c7c
commit e70d1b0540
Signed by untrusted user: codimp
GPG Key ID: E4B0289A04C9CBF6
3 changed files with 9 additions and 4 deletions

View File

@ -286,7 +286,7 @@ def run_actions(
global_arguments = arguments['global']
dry_run_label = ' (dry run; not making any changes)' if global_arguments.dry_run else ''
hook_context = {
'label': repository.get('label', ''),
'repository_label': repository.get('label', ''),
'repository': repository_path,
# Deprecated: For backwards compatibility with borgmatic < 1.6.0.
'repositories': ','.join([repo['path'] for repo in config['repositories']]),

View File

@ -84,8 +84,8 @@ variables you can use here:
path of the borgmatic log file, only set when the `--log-file` flag is used
* `repository`: path of the current repository as configured in the current
borgmatic configuration file
* `label`: current repository label as configured in the current borgmatic
configuration file
* `repository_label`: current repository label as configured in the current
borgmatic configuration file
Note that you can also interpolate in [arbitrary environment
variables](https://torsion.org/borgmatic/docs/how-to/provide-your-passwords/).

View File

@ -497,7 +497,12 @@ def test_run_actions_adds_log_file_to_hook_context():
repository={'path': 'repo', 'label': ''},
config={'repositories': []},
config_paths=[],
hook_context={'repository': 'repo', 'label': '', 'repositories': '', 'log_file': 'foo'},
hook_context={
'repository': 'repo',
'repository_label': '',
'repositories': '',
'log_file': 'foo',
},
local_borg_version=object,
create_arguments=object,
global_arguments=object,