feat: add logfile name to hook context for interpolation
This commit is contained in:
parent
a9a65ebe54
commit
0fbdf8d860
2 changed files with 26 additions and 0 deletions
|
@ -269,6 +269,12 @@ def run_actions(
|
||||||
'repositories': ','.join([repo['path'] for repo in location['repositories']]),
|
'repositories': ','.join([repo['path'] for repo in location['repositories']]),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
log_file = global_arguments.log_file
|
||||||
|
hook_context['log_file'] = log_file
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
command.execute_hook(
|
command.execute_hook(
|
||||||
hooks.get('before_actions'),
|
hooks.get('before_actions'),
|
||||||
hooks.get('umask'),
|
hooks.get('umask'),
|
||||||
|
|
|
@ -422,6 +422,26 @@ def test_run_actions_runs_rcreate():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_run_actions_adds_log_file_to_hook_context():
|
||||||
|
flexmock(module).should_receive('add_custom_log_levels')
|
||||||
|
flexmock(module.command).should_receive('execute_hook')
|
||||||
|
flexmock(borgmatic.actions.rcreate).should_receive('run_rcreate').once()
|
||||||
|
|
||||||
|
tuple(
|
||||||
|
module.run_actions(
|
||||||
|
arguments={'global': flexmock(dry_run=False, log_file='foo'), 'rcreate': flexmock()},
|
||||||
|
config_filename=flexmock(),
|
||||||
|
location={'repositories': []},
|
||||||
|
storage=flexmock(),
|
||||||
|
retention=flexmock(),
|
||||||
|
consistency=flexmock(),
|
||||||
|
hooks={},
|
||||||
|
local_path=flexmock(),
|
||||||
|
remote_path=flexmock(),
|
||||||
|
local_borg_version=flexmock(),
|
||||||
|
repository={'path': 'repo'},
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def test_run_actions_runs_transfer():
|
def test_run_actions_runs_transfer():
|
||||||
flexmock(module).should_receive('add_custom_log_levels')
|
flexmock(module).should_receive('add_custom_log_levels')
|
||||||
|
|
Loading…
Reference in a new issue