Commit 9f1ff24e authored by root's avatar root
Browse files

Merge branch 'master' of https://github.com/tribe29/checkmk

parents 372aa370 5a50beb6
Title: Notification spooler: Fix execution of notifications on sites only forwarding
Class: fix
Compatible: compat
Component: notifications
Date: 1652947508
Edition: cee
Knowledge: doc
Level: 1
State: unknown
Version: 2.2.0i1
On sites which had the option "Forward to remote site by notification spooler"
configured, the answer of the target site also lead to execution of of the
notification at this site, leading to duplicated notifications.
Furthermore, the result of the execution was not logged to history.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import os import os
import subprocess import subprocess
from logging import Logger from logging import Logger
from typing import List, NewType, Optional from typing import List, NewType, Optional, TypedDict
import cmk.utils.defines import cmk.utils.defines
from cmk.utils.exceptions import MKGeneralException from cmk.utils.exceptions import MKGeneralException
...@@ -25,6 +25,14 @@ NotificationPluginName = NewType("NotificationPluginName", str) ...@@ -25,6 +25,14 @@ NotificationPluginName = NewType("NotificationPluginName", str)
NotificationContext = NewType("NotificationContext", dict[str, str]) NotificationContext = NewType("NotificationContext", dict[str, str])
class NotificationResult(TypedDict, total=False):
plugin: NotificationPluginName
status: NotificationResultCode
output: List[str]
forward: bool
context: NotificationContext
def _state_for(exit_code: NotificationResultCode) -> str: def _state_for(exit_code: NotificationResultCode) -> str:
return cmk.utils.defines.service_state_name(exit_code, "UNKNOWN") return cmk.utils.defines.service_state_name(exit_code, "UNKNOWN")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment