Module: check_mk
Branch: master
Commit: 34ffec1e5ed766c818b5192cf4861858e6ce39a4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=34ffec1e5ed766…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Jul 17 13:29:55 2018 +0200
Simplified inheritance hierarchy. Improved comments.
Change-Id: Ia96cee0cffe864ae145f3ac61f1c893793aab87d
---
cmk/gui/gui_background_job.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/cmk/gui/gui_background_job.py b/cmk/gui/gui_background_job.py
index 0069151..0d5e435 100644
--- a/cmk/gui/gui_background_job.py
+++ b/cmk/gui/gui_background_job.py
@@ -169,10 +169,7 @@ class GUIBackgroundJobSnapshottedFunctions(background_job.BackgroundJob):
return super(GUIBackgroundJobSnapshottedFunctions, self).get_title()
-# TODO: The superclasses are nonsense: GUIBackgroundJobSnapshottedFunctions
-# already derives from background_jobs.BackgroundJob. What is the right way to
-# fix this?
-class GUIBackgroundJob(GUIBackgroundJobSnapshottedFunctions, background_job.BackgroundJob):
+class GUIBackgroundJob(GUIBackgroundJobSnapshottedFunctions):
_background_process_class = GUIBackgroundProcess
def __init__(self, job_id, **kwargs):
@@ -213,10 +210,13 @@ class GUIBackgroundJob(GUIBackgroundJobSnapshottedFunctions, background_job.Back
-# Provides the frozen state of a background job
-# Quite helpful when generating GUI pages with several phases
-
-# TODO: What on earth is this class supposed to do?
+# GUI pages are built in several phases, and each face can take a non-trivial
+# amount of time. Nevertheless, it is crucial to render a consistent state of
+# the background job in question. The class below provides such a status
+# snapshot for the job given to the constructor.
+#
+# TODO: BackgroundJob should provide an explicit status object, which we can use
+# here without any metaprogramming Kung Fu and arcane inheritance hierarchies.
class GUIBackgroundStatusSnapshot(object):
def __init__(self, background_job):
super(GUIBackgroundStatusSnapshot, self).__init__()
Module: check_mk
Branch: master
Commit: ab0789b4b2e2e92accef170404b4eb3e45a6d44b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ab0789b4b2e2e9…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Mon Jul 16 14:49:56 2018 +0200
livestatus_status: Avoid changing imput parameters
Change-Id: Icfe044725ef60a1d0fde68054045a7d8d5910734
---
checks/livestatus_status | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/checks/livestatus_status b/checks/livestatus_status
index 6d7d6a3..40d028c 100644
--- a/checks/livestatus_status
+++ b/checks/livestatus_status
@@ -120,16 +120,6 @@ def check_livestatus_status(item, params, parsed):
yield 0, "Core version: %s" % status["program_version"]
yield 0, "Livestatus version: %s" % status["livestatus_version"]
- if status["program_version"].startswith("Check_MK 1.2.6"):
- # In CMC <= 1.2.6 event handlers cannot be enabled. So never warn.
- params["enable_event_handlers"] = 0
- elif status.get("has_event_handlers", '1') == '0':
- # After update from < 1.2.7 the check would warn about disabled alert
- # handlers since they are disabled in this case. But the user has no alert
- # handlers defined, so this is nothing to warn about. Start warn when the
- # user defines his first alert handlers.
- params["enable_event_handlers"] = 0
-
settings = [
("execute_host_checks", "Active host checks are disabled"),
("execute_service_checks", "Active service checks are disabled"),
@@ -137,7 +127,7 @@ def check_livestatus_status(item, params, parsed):
("accept_passive_service_checks", "Passive service checks are disabled"),
("check_host_freshness", "Host freshness checking is disabled"),
("check_service_freshness", "Service freshness checking is disabled"),
- ("enable_event_handlers", "Alert handlers are disabled"),
+ # ("enable_event_handlers", "Alert handlers are disabled"), # special case below
("enable_flap_detection", "Flap detection is disabled"),
("enable_notifications", "Notifications are disabled"),
("process_performance_data", "Performance data is disabled"),
@@ -148,6 +138,20 @@ def check_livestatus_status(item, params, parsed):
if status[settingname] != '1' and params[settingname] != 0:
yield params[settingname], title
+ # special considerations for enable_event_handlers
+ if status["program_version"].startswith("Check_MK 1.2.6"):
+ # In CMC <= 1.2.6 event handlers cannot be enabled. So never warn.
+ return
+ if status.get("has_event_handlers", '1') == '0':
+ # After update from < 1.2.7 the check would warn about disabled alert
+ # handlers since they are disabled in this case. But the user has no alert
+ # handlers defined, so this is nothing to warn about. Start warn when the
+ # user defines his first alert handlers.
+ return
+ else:
+ if status["enable_event_handlers"] != '1' and params["enable_event_handlers"] != 0:
+ yield params["enable_event_handlers"], "Alert handlers are disabled"
+
check_info['livestatus_status'] = {
"parse_function" : parse_livestatus_status,