replace label presence condition with get method

This commit is contained in:
Codimp 2024-04-29 10:37:58 +02:00
parent 9f2facad9d
commit b67f729c7c
Signed by untrusted user: codimp
GPG Key ID: E4B0289A04C9CBF6

View File

@ -283,14 +283,10 @@ def run_actions(
'''
add_custom_log_levels()
repository_path = os.path.expanduser(repository['path'])
if 'label' in repository:
repository_label = repository['label']
else:
repository_label = ''
global_arguments = arguments['global']
dry_run_label = ' (dry run; not making any changes)' if global_arguments.dry_run else ''
hook_context = {
'label': repository_label,
'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']]),