Module: check_mk
Branch: master
Commit: 25ae36d75f5a7eb15b57f2f0882c53a28549ecb7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=25ae36d75f5a7e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jun 4 17:33:15 2012 +0200
saveint() now handles non-empty strings
---
modules/check_mk_base.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 5c75c0b..e330aad 100755
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -1107,12 +1107,13 @@ def get_regex(pattern):
# Names of texts usually output by checks
nagios_state_names = ["OK", "WARN", "CRIT",
"UNKNOWN"]
-# int() function that return 0 for empty strings
+# int() function that return 0 for strings the
+# cannot be converted to a number
def saveint(i):
- if i == '':
- return 0
- else:
+ try:
return int(i)
+ except:
+ return 0
def savefloat(f):
try: