default apprise notify type per borgmatic state
This commit is contained in:
parent
f3295ccb4a
commit
86011c8418
1 changed files with 12 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue