Module: check_mk
Branch: master
Commit: 9cbb1212592cd651a4ac0b37f2cd5b65c32cbd3a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9cbb1212592cd6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 10 11:03:16 2015 +0100
Hack for handling UnicodeWarnings during new service matching
---
modules/check_mk.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 8f99421..f027f39 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -34,6 +34,12 @@
import os, sys, socket, time, getopt, glob, re, stat, py_compile, urllib, inspect
import subprocess
+# Hack needed to fix UnicodeWarning in in_extraconf_servicelist(). This
+# can be removed once the encoding of autocheck's items are handled correctly
+# as unicode strings
+import warnings
+warnings.simplefilter("error", UnicodeWarning)
+
# These variable will be substituted at 'make dist' time
check_mk_version = '(inofficial)'
@@ -1881,7 +1887,6 @@ def in_extraconf_servicelist(service_matchers, item):
try:
result = func(item)
except (UnicodeDecodeError, UnicodeWarning), e:
- print 'catched', type(e), item
# FIXME: items in autochecks might contain umlauts, the strings
# are saved as UTF-8 encoded ascii strings. should be saved as
# unicode strings in this case or at least converted after reading.