Module: check_mk
Branch: master
Commit: 399d81a9fde0f7a7f67355f1c7421e018d1e9b7f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=399d81a9fde0f7…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Oct 18 17:40:43 2018 +0200
Fixed pick issue; Cleaned up multiple inheritance on the way
Change-Id: I7d67f179ea1d4b9ac1023f968aabb814771d8553
---
cmk/gui/plugins/wato/ac_tests.py | 43 ++++++----------------------------------
cmk/gui/watolib.py | 31 +++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/cmk/gui/plugins/wato/ac_tests.py b/cmk/gui/plugins/wato/ac_tests.py
index 05ec188..3fb7d24 100644
--- a/cmk/gui/plugins/wato/ac_tests.py
+++ b/cmk/gui/plugins/wato/ac_tests.py
@@ -417,38 +417,7 @@ class ACTestBackupNotEncryptedConfigured(ACTest):
-class ACMicrocoreTest(object):
- """Abstract base class for microcore specific tests"""
- __metaclass__ = abc.ABCMeta
-
- def _uses_microcore(self):
- local_connection = sites.livestatus.LocalConnection()
- version = local_connection.query_value("GET status\nColumns:
program_version\n", deflt="")
- return version.startswith("Check_MK")
-
-
- def _get_effective_global_setting(self, varname):
- global_settings = watolib.load_configuration_settings()
- default_values = watolib.ConfigDomain().get_all_default_globals()
-
- if watolib.is_wato_slave_site():
- current_settings = watolib.load_configuration_settings(site_specific=True)
- else:
- sites = watolib.SiteManagementFactory.factory().load_sites()
- current_settings = sites[config.omd_site()].get("globals", {})
-
- if varname in current_settings:
- value = current_settings[varname]
- elif varname in global_settings:
- value = global_settings[varname]
- else:
- value = default_values[varname]
-
- return value
-
-
-
-class ACApacheTest(object):
+class ACApacheTest(ACTest):
"""Abstract base class for apache related tests"""
__metaclass__ = abc.ABCMeta
@@ -483,7 +452,7 @@ class ACApacheTest(object):
-class ACTestApacheNumberOfProcesses(ACTest, ACApacheTest):
+class ACTestApacheNumberOfProcesses(ACApacheTest):
def category(self):
return ACTestCategories.performance
@@ -567,7 +536,7 @@ class ACTestApacheNumberOfProcesses(ACTest, ACApacheTest):
-class ACTestApacheProcessUsage(ACTest, ACApacheTest):
+class ACTestApacheProcessUsage(ACApacheTest):
def category(self):
return ACTestCategories.performance
@@ -609,7 +578,7 @@ class ACTestApacheProcessUsage(ACTest, ACApacheTest):
-class ACTestCheckMKHelperUsage(ACTest, ACMicrocoreTest):
+class ACTestCheckMKHelperUsage(ACTest):
def category(self):
return ACTestCategories.performance
@@ -671,7 +640,7 @@ class ACTestCheckMKHelperUsage(ACTest, ACMicrocoreTest):
-class ACTestAlertHandlerEventTypes(ACTest, ACMicrocoreTest):
+class ACTestAlertHandlerEventTypes(ACTest):
def category(self):
return ACTestCategories.performance
@@ -699,7 +668,7 @@ class ACTestAlertHandlerEventTypes(ACTest, ACMicrocoreTest):
-class ACTestGenericCheckHelperUsage(ACTest, ACMicrocoreTest):
+class ACTestGenericCheckHelperUsage(ACTest):
def category(self):
return ACTestCategories.performance
diff --git a/cmk/gui/watolib.py b/cmk/gui/watolib.py
index 15ec529..3ebf4b4 100644
--- a/cmk/gui/watolib.py
+++ b/cmk/gui/watolib.py
@@ -10198,10 +10198,41 @@ class ACTest(object):
return self._results
+ def _uses_microcore(self):
+ """Whether or not the local site is using the
CMC"""
+ local_connection = sites.livestatus.LocalConnection()
+ version = local_connection.query_value("GET status\nColumns:
program_version\n", deflt="")
+ return version.startswith("Check_MK")
+
+
+ def _get_effective_global_setting(self, varname):
+ global_settings = load_configuration_settings()
+ default_values = ConfigDomain().get_all_default_globals()
+
+ if is_wato_slave_site():
+ current_settings = load_configuration_settings(site_specific=True)
+ else:
+ sites = SiteManagementFactory.factory().load_sites()
+ current_settings = sites[config.omd_site()].get("globals", {})
+
+ if varname in current_settings:
+ value = current_settings[varname]
+ elif varname in global_settings:
+ value = global_settings[varname]
+ else:
+ value = default_values[varname]
+
+ return value
+
+
def check_analyze_config():
results = []
+ # TODO: I'll clean up this plugin mechanism soon
for test_cls in ACTest.__subclasses__(): # pylint: disable=no-member
+ if test_cls.__subclasses__(): # pylint: disable=no-member
+ continue # Only use leaf classes
+
test = test_cls()
if not test.is_relevant():