Module: check_mk
Branch: master
Commit: 51e9971e41ee183ea9fd6f405369488e18f26e0f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=51e9971e41ee18…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Feb 12 12:32:48 2019 +0100
6704 FIX Fixed problem where persistent information of hosts was randomly missing, causing
services to go stale
CMK-1670
Change-Id: Ib23e6d446761dd1c511060b89adf6c4ad19c6da3
---
.werks/6704 | 11 +++++++++++
cmk_base/data_sources/abstract.py | 10 +++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/.werks/6704 b/.werks/6704
new file mode 100644
index 0000000..461e986
--- /dev/null
+++ b/.werks/6704
@@ -0,0 +1,11 @@
+Title: Fixed problem where persistent information of hosts was randomly missing, causing
services to go stale
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1549970984
+
+
diff --git a/cmk_base/data_sources/abstract.py b/cmk_base/data_sources/abstract.py
index 283f9630..48a4b52 100644
--- a/cmk_base/data_sources/abstract.py
+++ b/cmk_base/data_sources/abstract.py
@@ -122,6 +122,9 @@ class DataSource(object):
try:
cpu_tracking.push_phase(self._cpu_tracking_id())
+ persisted_sections_from_disk = self._load_persisted_sections()
+ self._persisted_sections = persisted_sections_from_disk
+
raw_data, is_cached_data = self._get_raw_data()
self._host_sections = host_sections = self._convert_to_sections(raw_data)
@@ -131,7 +134,8 @@ class DataSource(object):
return raw_data
# Add information from previous persisted infos
- host_sections = self._update_info_with_persisted_sections(host_sections,
is_cached_data)
+ host_sections =
self._update_info_with_persisted_sections(persisted_sections_from_disk,
+ host_sections,
is_cached_data)
self._persisted_sections = host_sections.persisted_sections
return host_sections
@@ -427,9 +431,9 @@ class DataSource(object):
store.save_data_to_file(file_path, persisted_sections, pretty=False)
self._logger.debug("Stored persisted sections: %s" % (",
".join(persisted_sections.keys())))
- def _update_info_with_persisted_sections(self, host_sections, is_cached_data):
+ def _update_info_with_persisted_sections(self, persisted_sections_from_disk,
host_sections, is_cached_data):
+ persisted_sections = persisted_sections_from_disk
persisted_sections_from_raw = host_sections.persisted_sections
- persisted_sections = self._load_persisted_sections()
if persisted_sections_from_raw and not is_cached_data:
persisted_sections.update(persisted_sections_from_raw)