Module: check_mk
Branch: master
Commit: 347553151d8bd2ed7f29bad53d713f62b52b0b34
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=347553151d8bd2…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon May 22 15:32:40 2017 +0200
Fixed pushover priority 'emergency' introduced with werk 4590
Change-Id: I44b53563d369b695a6f8df938e5f8a67b649ee26
---
notifications/pushover | 22 ++++++++++++----------
web/plugins/wato/notifications.py | 5 +++--
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/notifications/pushover b/notifications/pushover
index 1aed40d..6bd25ea 100755
--- a/notifications/pushover
+++ b/notifications/pushover
@@ -124,29 +124,31 @@ def send_push_notification(api_key, recipient_key, subject, text,
context):
("html", 1),
]
- if context.get("PARAMETER_PRIORITY", 0):
+ if context.get("PARAMETER_PRIORITY") in ["-2", "-1",
"0", "1"]:
+ params += [("priority", context["PARAMETER_PRIORITY"])]
+
+ elif context.get("PARAMETER_PRIORITY_PRIORITY") == "2":
params += [
- ("priority", context["PARAMETER_PRIORITY"]),
+ ("priority", context["PARAMETER_PRIORITY_PRIORITY"]),
("expire", context.get("PARAMETER_PRIORITY_EXPIRE",
0)),
("retry", context.get("PARAMETER_PRIORITY_RETRY",
0)),
]
-
- if context.get("PARAMETER_PRIORITY_RECEIPTS"):
- params.append( ("receipts",
context["PARAMETER_PRIORITY_RECEIPTS"]) )
+ if context.get("PARAMETER_PRIORITY_RECEIPTS"):
+ params.append(("receipts",
context["PARAMETER_PRIORITY_RECEIPTS"]))
if context.get("PARAMETER_SOUND", "none") != "none":
- params.append( ("sound", context["PARAMETER_SOUND"]) )
+ params.append(("sound", context["PARAMETER_SOUND"]))
s = requests.Session()
- if context.get("PARAMETER_PROXY_URL"):
- if context["PARAMETER_PROXY_URL"].startswith('https'):
+ if context.get("PARAMETER_PROXY"):
+ if context["PARAMETER_PROXY"].startswith('https'):
protocol = 'https'
else:
protocol = 'http'
- r = s.get(api_url, params=dict(params), proxies={protocol :
context["PARAMETER_PROXY_URL"]})
+ r = s.post(api_url, params=dict(params), proxies={protocol :
context["PARAMETER_PROXY"]})
else:
- r = s.get(api_url, params=dict(params))
+ r = s.post(api_url, params=dict(params))
r_status = r.status_code
if r_status == '200':
diff --git a/web/plugins/wato/notifications.py b/web/plugins/wato/notifications.py
index e6106fd..143afaf 100644
--- a/web/plugins/wato/notifications.py
+++ b/web/plugins/wato/notifications.py
@@ -288,14 +288,15 @@ register_notification_parameters(
# in modules/events.py can't handle complex data structures
def transform_back_pushover_priority(params):
if type(params) == tuple:
- return {"retry" : params[1][0],
+ return {"priority" : "2",
+ "retry" : params[1][0],
"expire" : params[1][1],
"receipts" : params[1][2]}
return params
def transform_forth_pushover_priority(params):
if type(params) == dict:
- return ("2", (params["retry"], params["expire"],
params["receipts"]))
+ return (params['priority'], (params["retry"],
params["expire"], params["receipts"]))
return params
register_notification_parameters("pushover", Dictionary(