Module: check_mk
Branch: master
Commit: 44449c2dfb69479f46c95510fa50ae1a1245efcc
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=44449c2dfb6947…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Oct 9 12:06:36 2017 +0200
5390 FIX MKP: Ignore *.pyc files when creating MKP packages
Packing the compiled pyc files into MKP packages is not a good idea,
because they are python version specific and can be created by the
target system at any time. So better ignore these files when creating
packages.
Change-Id: Ie7bf289e711dd4c6eaf38618d0fc49266560f665
---
.werks/5390 | 13 +++++++++++++
cmk_base/packaging.py | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/5390 b/.werks/5390
new file mode 100644
index 0000000..c0fc01d
--- /dev/null
+++ b/.werks/5390
@@ -0,0 +1,13 @@
+Title: MKP: Ignore *.pyc files when creating MKP packages
+Level: 1
+Component: core
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1507543532
+Class: fix
+
+Packing the compiled pyc files into MKP packages is not a good idea,
+because they are python version specific and can be created by the
+target system at any time. So better ignore these files when creating
+packages.
diff --git a/cmk_base/packaging.py b/cmk_base/packaging.py
index 60e1b08..5ffc0f0 100644
--- a/cmk_base/packaging.py
+++ b/cmk_base/packaging.py
@@ -591,7 +591,7 @@ def files_in_dir(part, dir, prefix = ""):
result = []
files = os.listdir(dir)
for f in files:
- if f in [ '.', '..' ] or f.startswith('.') or f.endswith('~'):
+ if f in [ '.', '..' ] or f.startswith('.') or f.endswith('~') or f.endswith(".pyc"):
continue
ignored = package_ignored_files.get(part, [])
Module: check_mk
Branch: master
Commit: 22557a5e644b28fcc6ba0f394d53dc9f3a182a1c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=22557a5e644b28…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Oct 9 09:08:24 2017 +0200
5389 FIX Fixed disabling services via discovery page when a host rule exists in wrong folder
Fixed two situation where disabling of services did not work correctly:
<ul>
<li>When a specific disable services rule was existing but not applying to the host,
because it was located in a non parent folder.</li>
<li>When a specific disable services rule was existing in a partent folder of the
host and not in the same folder as the host.</li>
</ul>
Change-Id: I2ad832b77b967a4b3cc04bf10dfecc92bcb60722
---
.werks/5389 | 18 ++++++++++++++++++
web/htdocs/wato.py | 21 +++++++++++++++++----
web/htdocs/watolib.py | 7 ++++---
3 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/.werks/5389 b/.werks/5389
new file mode 100644
index 0000000..9eb2e71
--- /dev/null
+++ b/.werks/5389
@@ -0,0 +1,18 @@
+Title: Fixed disabling services via discovery page when a host rule exists in wrong folder
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1507532119
+
+Fixed two situation where disabling of services did not work correctly:
+
+<ul>
+ <li>When a specific disable services rule was existing but not applying to the host,
+ because it was located in a non parent folder.</li>
+ <li>When a specific disable services rule was existing in a partent folder of the
+ host and not in the same folder as the host.</li>
+</ul>
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index ff3620b..90f19a9 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2972,8 +2972,10 @@ class ModeDiscovery(WatoMode):
except KeyError:
ruleset = Ruleset("ignored_services")
+ modified_folders = []
+
service_patterns = _compile_patterns(services)
- self._remove_from_rule_of_host(ruleset, service_patterns, value=not value)
+ modified_folders += 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
# the host specific setting above and remove all services from the service list
@@ -2985,8 +2987,10 @@ class ModeDiscovery(WatoMode):
services.remove(service)
service_patterns = _compile_patterns(services)
- self._update_rule_of_host(ruleset, service_patterns, value=value)
- rulesets.save_folder(self._host.folder())
+ modified_folders += self._update_rule_of_host(ruleset, service_patterns, value=value)
+
+ for folder in modified_folders:
+ rulesets.save_folder(folder)
def _remove_from_rule_of_host(self, ruleset, service_patterns, value):
@@ -2998,6 +3002,10 @@ class ModeDiscovery(WatoMode):
if not other_rule.item_list:
ruleset.delete_rule(other_rule)
+ return [ other_rule.folder ]
+
+ return []
+
def _update_rule_of_host(self, ruleset, service_patterns, value):
folder = self._host.folder()
@@ -3014,10 +3022,15 @@ class ModeDiscovery(WatoMode):
rule.value = value
ruleset.prepend_rule(folder, rule)
+ if rule:
+ return [rule.folder]
+ else:
+ return []
+
def _get_rule_of_host(self, ruleset, value):
for folder, index, rule in ruleset.get_rules():
- if rule.is_discovery_rule_of(self._host.name()) and rule.value == value:
+ if rule.is_discovery_rule_of(self._host) and rule.value == value:
return rule
return None
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 6687ea0..3c32511 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -8244,10 +8244,11 @@ class Rule(object):
return self.rule_options.get("comment", "")
- def is_discovery_rule_of(self, host_name):
- return self.host_list == [host_name] \
+ def is_discovery_rule_of(self, host):
+ return self.host_list == [host.name()] \
and self.tag_specs == [] \
- and all([ i.endswith("$") for i in self.item_list ])
+ and all([ i.endswith("$") for i in self.item_list ]) \
+ and self.folder.is_transitive_parent_of(host.folder())