Module: check_mk
Branch: master
Commit: cd03e2b5462705f70915e1331a2d0c4de0ad985c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cd03e2b5462705…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jun 28 15:41:37 2017 +0200
4919 FIX Service discovery: Fixed disabling services with backslashes in description
Change-Id: I5f3ed847824200f936c38fd76d7abd9167bcf06b
---
.werks/4919 | 11 +++++++++++
web/htdocs/wato.py | 7 +++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/.werks/4919 b/.werks/4919
new file mode 100644
index 0000000..db6fccf
--- /dev/null
+++ b/.werks/4919
@@ -0,0 +1,11 @@
+Title: Service discovery: Fixed disabling services with backslashes in description
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1498657276
+
+
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index c86a15b..8694d2a 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2874,6 +2874,9 @@ class ModeDiscovery(WatoMode):
if not services:
return
+ def _compile_patterns(services):
+ return [ ("%s$" % s.replace("\\", "\\\\")) for
s in services ]
+
rulesets = AllRulesets()
rulesets.load()
@@ -2882,7 +2885,7 @@ class ModeDiscovery(WatoMode):
except KeyError:
ruleset = Ruleset("ignored_services")
- service_patterns = [ ("%s$" % s) for s in services ]
+ service_patterns = _compile_patterns(services)
self._remove_from_rule_of_host(ruleset, service_patterns, value=not value)
# Check whether or not the service still needs a host specific setting after
removing
@@ -2894,7 +2897,7 @@ class ModeDiscovery(WatoMode):
or value == value_without_host_rule:
services.remove(service)
- service_patterns = [ ("%s$" % s) for s in services ]
+ service_patterns = _compile_patterns(services)
self._update_rule_of_host(ruleset, service_patterns, value=value)
rulesets.save_folder(self._host.folder())