mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-07-22 02:03:01 +02:00
Fix a regression in which the ntfy monitoring hook failed to send a ping when the "priority" option was set (#1246).
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
just skipping the Borg call.
|
||||
* #1242: Fix a regression in which the "spot" check hung while collecting archive contents.
|
||||
* #1245: Fix a regression in which the KeePassXC credential hook password prompt was invisible.
|
||||
* #1246: Fix a regression in which the ntfy monitoring hook failed to send a ping when the
|
||||
"priority" option was set.
|
||||
|
||||
2.1.0
|
||||
* TL;DR: Many logging, memory, and performance improvements. Mind those breaking changes!
|
||||
|
||||
@@ -2342,6 +2342,13 @@ properties:
|
||||
example: Your backups have started.
|
||||
priority:
|
||||
type: string
|
||||
enum:
|
||||
- max
|
||||
- urgent
|
||||
- high
|
||||
- default
|
||||
- low
|
||||
- min
|
||||
description: |
|
||||
The priority to set.
|
||||
example: min
|
||||
@@ -2366,6 +2373,13 @@ properties:
|
||||
example: Your backups have finished.
|
||||
priority:
|
||||
type: string
|
||||
enum:
|
||||
- max
|
||||
- urgent
|
||||
- high
|
||||
- default
|
||||
- low
|
||||
- min
|
||||
description: |
|
||||
The priority to set.
|
||||
example: min
|
||||
@@ -2390,6 +2404,13 @@ properties:
|
||||
example: Your backups have failed.
|
||||
priority:
|
||||
type: string
|
||||
enum:
|
||||
- max
|
||||
- urgent
|
||||
- high
|
||||
- default
|
||||
- low
|
||||
- min
|
||||
description: |
|
||||
The priority to set.
|
||||
example: max
|
||||
|
||||
@@ -22,6 +22,16 @@ def initialize_monitor(
|
||||
'''
|
||||
|
||||
|
||||
PRIORITY_NAME_TO_ID = {
|
||||
'max': 5,
|
||||
'urgent': 5,
|
||||
'high': 4,
|
||||
'default': 3,
|
||||
'low': 2,
|
||||
'min': 1,
|
||||
}
|
||||
|
||||
|
||||
def ping_monitor(hook_config, config, config_filename, state, monitoring_log_level, dry_run):
|
||||
'''
|
||||
Ping the configured Ntfy topic. Use the given configuration filename in any log entries.
|
||||
@@ -31,13 +41,13 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev
|
||||
|
||||
if state.name.lower() in run_states:
|
||||
dry_run_label = ' (dry run; not actually pinging)' if dry_run else ''
|
||||
|
||||
default_priority = PRIORITY_NAME_TO_ID['default']
|
||||
state_config = hook_config.get(
|
||||
state.name.lower(),
|
||||
{
|
||||
'title': f'A borgmatic {state.name} event happened',
|
||||
'message': f'A borgmatic {state.name} event happened',
|
||||
'priority': 'default',
|
||||
'priority': default_priority,
|
||||
'tags': 'borgmatic',
|
||||
},
|
||||
)
|
||||
@@ -55,7 +65,7 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev
|
||||
'topic': topic,
|
||||
'title': state_config.get('title'),
|
||||
'message': state_config.get('message'),
|
||||
'priority': state_config.get('priority'),
|
||||
'priority': PRIORITY_NAME_TO_ID.get(state_config.get('priority'), default_priority),
|
||||
'tags': state_config.get('tags'),
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ CUSTOM_MESSAGE_PAYLOAD = {
|
||||
'topic': TOPIC,
|
||||
'title': CUSTOM_MESSAGE_CONFIG['title'],
|
||||
'message': CUSTOM_MESSAGE_CONFIG['message'],
|
||||
'priority': CUSTOM_MESSAGE_CONFIG['priority'],
|
||||
'priority': 1,
|
||||
'tags': CUSTOM_MESSAGE_CONFIG['tags'],
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ def default_message_payload(state=Enum):
|
||||
'topic': TOPIC,
|
||||
'title': f'A borgmatic {state.name} event happened',
|
||||
'message': f'A borgmatic {state.name} event happened',
|
||||
'priority': 'default',
|
||||
'priority': 3,
|
||||
'tags': 'borgmatic',
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user