Module: check_mk
Branch: master
Commit: 4a999dedb528871c3fe5813eb938d868ae931628
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4a999dedb52887…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jul 22 18:05:07 2013 +0200
FIX: notify: fix exception on latin-1 encoded variable content
---
modules/notify.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/modules/notify.py b/modules/notify.py
index 39dd198..5ac931f 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -429,7 +429,17 @@ def notification_context_from_env():
for (var, value)
in os.environ.items()
if var.startswith("NOTIFY_")
- and not re.match('^\$[A-Z]+\$$', value)])
+ and not dead_nagios_variable(value) ])
+
+def dead_nagios_variable(value):
+ if len(value) < 3:
+ return False
+ if value[0] != '$' or value[-1] != '$':
+ return False
+ for c in value[1:-1]:
+ if not c.isupper() and c != '_':
+ return False
+ return True
def convert_context_to_unicode(context):