From 5a989826a10efad5771877006fce11626620f740 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sat, 23 Sep 2023 21:33:50 +0200 Subject: [PATCH] convert map to list for apprise function call fix apprise config schema remove apprise from required dependencies --- borgmatic/config/schema.yaml | 26 ++++++++++++++------------ borgmatic/hooks/apprise.py | 2 +- setup.py | 3 +-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index 7315a22..b7ca1bf 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -1308,21 +1308,23 @@ properties: - finish apprise: type: object - required: ['service_urls'] + required: ['services'] additionalProperties: false properties: services: - type: object - required: - - url - - label - properties: - url: - type: string - example: "mastodon://accesskey/host/?visibility=direct" - label: - type: string - example: mastodon + type: array + items: + type: object + required: + - url + - label + properties: + url: + type: string + example: "mastodon://accesskey/host/?visibility=direct" + label: + type: string + example: mastodon description: | A list of Apprise services to publish to with URLs and labels. The labels are used for logging. diff --git a/borgmatic/hooks/apprise.py b/borgmatic/hooks/apprise.py index 184c75f..b70532b 100644 --- a/borgmatic/hooks/apprise.py +++ b/borgmatic/hooks/apprise.py @@ -53,7 +53,7 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev notify_type = state_to_notify_type[state.name.lower()] apprise_object = apprise.Apprise() - apprise_object.add(map(lambda service: service['url'], hook_config.get('services'))) + apprise_object.add(list(map(lambda service: service['url'], hook_config.get('services')))) if dry_run: return diff --git a/setup.py b/setup.py index cf892b9..b4757d4 100644 --- a/setup.py +++ b/setup.py @@ -34,8 +34,7 @@ setup( 'packaging', 'requests', 'ruamel.yaml>0.15.0,<0.18.0', - 'setuptools', - 'apprise' + 'setuptools' ), extra_require={ "Apprise": ["apprise"]