Module: check_mk
Branch: master
Commit: 6ae3dbd0673bf5c001f958eafb57d1262866d7f9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6ae3dbd0673bf5…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Nov 6 13:40:42 2015 +0100
Fix duplicate warning message for discovery errors
---
modules/discovery.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/modules/discovery.py b/modules/discovery.py
index d40bfab..807527e 100644
--- a/modules/discovery.py
+++ b/modules/discovery.py
@@ -673,10 +673,10 @@ def snmp_scan(hostname, ipaddress, on_error = "ignore",
for_inv=False):
return value
result = scan_function(oid_function)
if result is not None and type(result) not in [ str, bool ]:
- if on_error != "ignore":
+ if on_error == "warn":
warning(" SNMP scan function of %s returns invalid type
%s." %
(check_type, type(result)))
- if on_error == "raise":
+ elif on_error == "raise":
raise MKGeneralException("SNMP Scan aborted.")
elif result:
found.append(check_type)
@@ -686,9 +686,9 @@ def snmp_scan(hostname, ipaddress, on_error = "ignore",
for_inv=False):
# should be raised through this
raise
except:
- if on_error != "ignore":
+ if on_error == "warn":
warning(" Exception in SNMP scan function of %s" %
check_type)
- if on_error == "raise":
+ elif on_error == "raise":
raise
pass
else:
@@ -788,9 +788,9 @@ def discover_check_type(hostname, ipaddress, check_type, use_caches,
on_error):
result.append((item, paramstring))
except Exception, e:
- if on_error != "ignore":
+ if on_error == "warn":
warning(" Exception in discovery function of check type '%s':
%s" % (check_type, e))
- if on_error == "raise":
+ elif on_error == "raise":
raise
return []