Module: check_mk
Branch: master
Commit: 8a4c0486cd35838e09e9f9950f475f959bf8b8d8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a4c0486cd3583…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 27 17:15:39 2018 +0200
6041 FIX Discovery: Exceptions during discovery produce crash reports again
It is intended that exceptions during service discovery lead to crash reports
instead of less helpful UNKOWN states with missing trace information. This broke
somewhere on the way to 1.5.
Change-Id: If1c0d9a2186a0cce45c679b3aaf15ed55b8b48eb
---
.werks/6041 | 13 +++++++++++++
cmk_base/checking.py | 2 +-
cmk_base/discovery.py | 7 ++++---
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/.werks/6041 b/.werks/6041
new file mode 100644
index 0000000..de63e2a
--- /dev/null
+++ b/.werks/6041
@@ -0,0 +1,13 @@
+Title: Discovery: Exceptions during discovery produce crash reports again
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1524842047
+
+It is intended that exceptions during service discovery lead to crash reports
+instead of less helpful UNKOWN states with missing trace information. This broke
+somewhere on the way to 1.5.
diff --git a/cmk_base/checking.py b/cmk_base/checking.py
index 695cca3..c338d1a 100644
--- a/cmk_base/checking.py
+++ b/cmk_base/checking.py
@@ -96,7 +96,7 @@ def handle_check_mk_check_result(check_plugin_name, description):
infotexts.append("%s" % e)
status = max(status, exit_spec.get("exception", 3))
- except Exception, e:
+ except Exception:
if cmk.debug.enabled():
raise
crash_output = cmk_base.crash_reporting.create_crash_dump(hostname,
check_plugin_name, None,
diff --git a/cmk_base/discovery.py b/cmk_base/discovery.py
index fcaf2a9..1c6ae4f 100644
--- a/cmk_base/discovery.py
+++ b/cmk_base/discovery.py
@@ -652,10 +652,11 @@ def _discover_services(hostname, ipaddress, sources,
multi_host_sections, on_err
discovered_services.append((check_plugin_name, item, paramstring))
except (KeyboardInterrupt, MKTimeout):
raise
- except Exception, e:
- if cmk.debug.enabled():
+ except Exception:
+ if on_error == "raise":
raise
- raise MKGeneralException("Exception in check plugin '%s':
%s" % (check_plugin_name, e))
+ elif on_error == "warn":
+ console.error("Discovery of '%s' failed: %s\n" %
(check_plugin_nam, e))
return discovered_services