default apprise notify type per borgmatic state

This commit is contained in:
Pim Kunis 2023-09-21 22:02:45 +02:00 committed by pizzapim
parent f3295ccb4a
commit 86011c8418

View file

@ -31,7 +31,7 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev
{ {
'title': f'A borgmatic {state.name} event happened', 'title': f'A borgmatic {state.name} event happened',
'body': f'A borgmatic {state.name} event happened', 'body': f'A borgmatic {state.name} event happened',
'notification_type': 'success', # TODO: default per state.name 'notification_type': default_notify_type(state.name.lower()),
# 'tag': ['borgmatic'], # 'tag': ['borgmatic'],
}, },
) )
@ -74,6 +74,17 @@ def get_notify_type(s):
return NotifyType.FAILURE return NotifyType.FAILURE
def default_notify_type(state):
if state == 'start':
return NotifyType.INFO
if state == 'finish':
return NotifyType.SUCCESS
if state == 'fail':
return NotifyType.FAILURE
if state == 'log':
return NotifyType.INFO
def destroy_monitor( def destroy_monitor(
ping_url_or_uuid, config, config_filename, monitoring_log_level, dry_run ping_url_or_uuid, config, config_filename, monitoring_log_level, dry_run
): # pragma: no cover ): # pragma: no cover