Add context for various hooks. #469

Merged
witten merged 2 commits from cyfdecyf/borgmatic:master into master 2022-03-14 20:13:16 +00:00
1 changed files with 12 additions and 0 deletions

View File

@ -62,6 +62,10 @@ def run_configuration(config_filename, config, arguments):
prune_create_or_check = {'prune', 'create', 'check'}.intersection(arguments)
monitoring_log_level = verbosity_to_log_level(global_arguments.monitoring_verbosity)
hook_context = {
'repository': ','.join(location['repositories']),
}
try:
if prune_create_or_check:
dispatch.call_hooks(
@ -79,6 +83,7 @@ def run_configuration(config_filename, config, arguments):
config_filename,
'pre-prune',
global_arguments.dry_run,
**hook_context,
)
if 'create' in arguments:
command.execute_hook(
@ -87,6 +92,7 @@ def run_configuration(config_filename, config, arguments):
config_filename,
'pre-backup',
global_arguments.dry_run,
**hook_context,
)
if 'check' in arguments:
command.execute_hook(
@ -95,6 +101,7 @@ def run_configuration(config_filename, config, arguments):
config_filename,
'pre-check',
global_arguments.dry_run,
**hook_context,
)
if 'extract' in arguments:
command.execute_hook(
@ -103,6 +110,7 @@ def run_configuration(config_filename, config, arguments):
config_filename,
'pre-extract',
global_arguments.dry_run,
**hook_context,
)
if prune_create_or_check:
dispatch.call_hooks(
@ -168,6 +176,7 @@ def run_configuration(config_filename, config, arguments):
config_filename,
'post-prune',
global_arguments.dry_run,
**hook_context,
)
if 'create' in arguments:
dispatch.call_hooks(
@ -184,6 +193,7 @@ def run_configuration(config_filename, config, arguments):
config_filename,
'post-backup',
global_arguments.dry_run,
**hook_context,
)
if 'check' in arguments:
command.execute_hook(
@ -192,6 +202,7 @@ def run_configuration(config_filename, config, arguments):
config_filename,
'post-check',
global_arguments.dry_run,
**hook_context,
)
if 'extract' in arguments:
command.execute_hook(
@ -200,6 +211,7 @@ def run_configuration(config_filename, config, arguments):
config_filename,
'post-extract',
global_arguments.dry_run,
**hook_context,
)
if prune_create_or_check:
dispatch.call_hooks(