Module: check_mk
Branch: master
Commit: 49aef0607610cedc69423e847546f7b205554845
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=49aef0607610ce…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed May 17 10:18:41 2017 +0200
4720 FIX The settings of the MK Notify daemon could be lost when saving other global
settings
When a problem occurs during plugin loading of WATO plugins, which should only occur
when
working with local modifications, it could happen that the global settings of the MK
notification
daemon were lost when editing any global configuration variable.
Change-Id: Ib2fdb2bcba5749e7246243f2008f03c048258d12
---
.werks/4720 | 13 +++++++++++++
web/htdocs/watolib.py | 12 ++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/.werks/4720 b/.werks/4720
new file mode 100644
index 0000000..b6b2053
--- /dev/null
+++ b/.werks/4720
@@ -0,0 +1,13 @@
+Title: The settings of the MK Notify daemon could be lost when saving other global
settings
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.5.0i1
+Date: 1495008952
+
+When a problem occurs during plugin loading of WATO plugins, which should only occur
when
+working with local modifications, it could happen that the global settings of the MK
notification
+daemon were lost when editing any global configuration variable.
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 661a5a2..fac4fc9 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -260,7 +260,15 @@ class ConfigDomain(object):
@classmethod
def all_classes(cls):
- return cls.__subclasses__() # pylint: disable=no-member
+ subclasses = cls.__subclasses__() # pylint: disable=no-member
+
+ # Classes may be registered twice, only store one of the occurances.
+ # TODO(lm): Find the reason for this and solve this issue in the plugin
mechanism.
+ classes = {}
+ for subclass in subclasses:
+ classes.setdefault(subclass.__name__, subclass)
+
+ return classes.values()
@classmethod
@@ -270,7 +278,7 @@ class ConfigDomain(object):
@classmethod
def get_class(cls, ident):
- for domain_class in cls.__subclasses__(): # pylint: disable=no-member
+ for domain_class in cls.all_classes():
if domain_class.ident == ident:
return domain_class
raise NotImplementedError(_("The domain \"%s\" does not
exist") % ident)