From 61e4eeff6ca9b7b0659960a306ba87879832b62a Mon Sep 17 00:00:00 2001 From: Antonio Fernandez Date: Wed, 13 Nov 2024 11:52:08 -0500 Subject: [PATCH] converted html to a boolean and updated documentation and schema --- borgmatic/config/schema.yaml | 24 ++++++++++++------------ borgmatic/hooks/pushover.py | 5 +++++ docs/how-to/monitor-your-backups.md | 6 +++--- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index 791bdabc..a8d81122 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -1664,11 +1664,11 @@ properties: that device instead of all devices. example: pixel8 html: - type: integer + type: boolean description: | - Set to 1 to enable HTML parsing of the message. Set - to 0 for plain text. - example: 1 + Set to True to enable HTML parsing of the message. + Set to False for plain text. + example: True sound: type: string description: | @@ -1740,11 +1740,11 @@ properties: that device instead of all devices. example: pixel8 html: - type: integer + type: boolean description: | - Set to 1 to enable HTML parsing of the message. Set - to 0 for plain text. - example: 1 + Set to True to enable HTML parsing of the message. + Set to False for plain text. + example: True sound: type: string description: | @@ -1815,11 +1815,11 @@ properties: that device instead of all devices. example: pixel8 html: - type: integer + type: boolean description: | - Set to 1 to enable HTML parsing of the message. Set - to 0 for plain text. - example: 1 + Set to True to enable HTML parsing of the message. + Set to False for plain text. + example: True sound: type: string description: | diff --git a/borgmatic/hooks/pushover.py b/borgmatic/hooks/pushover.py index f6a31030..77ba48c5 100644 --- a/borgmatic/hooks/pushover.py +++ b/borgmatic/hooks/pushover.py @@ -48,6 +48,11 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev state_config.pop('expire', None) state_config.pop('retry', None) + state_config = { + key: (1 if value is True and key in 'html' else value) + for key, value in state_config.items() + } + data = dict( { 'token': token, diff --git a/docs/how-to/monitor-your-backups.md b/docs/how-to/monitor-your-backups.md index 075caaf9..e708c005 100644 --- a/docs/how-to/monitor-your-backups.md +++ b/docs/how-to/monitor-your-backups.md @@ -333,7 +333,7 @@ pushover: message: "Backup Started" priority: -2 title: "Backup Started" - html: 1 + html: True ttl: 10 # Message will be deleted after 10 seconds. fail: message: "Backup Failed" @@ -342,7 +342,7 @@ pushover: retry: 30 # Used only for priority 2. Default is 30 seconds. device: "pixel8" title: "Backup Failed" - html: 1 + html: True sound: "siren" url: "https://ticketing-system.example.com/login" url_title: "Login to ticketing system" @@ -350,7 +350,7 @@ pushover: message: "Backup Finished" priority: 0 title: "Backup Finished" - html: 1 + html: True ttl: 60 url: "https://ticketing-system.example.com/login" url_title: "Login to ticketing system"