Module: check_mk
Branch: master
Commit: 6ecce66e555a6a42b9c886659745acc3d6a80801
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6ecce66e555a6a…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Tue Jan 22 17:16:24 2019 +0100
Fix update to new predictive levels format
When updating to the new scheme of predictive levels, cached data changed
format and thus old prediction were deleted upon retrieval and new needed
to be calculated on a new step. In the case when the intention is to delete
old predictions on purpose it wasn't checked that they belonged to the old
format but assumed they were already updated. Because during development
one retrieves data always earlier than the maintenance cleanup.
Change-Id: Ie23431019fa8b21fb1a32706314cf8866d654fe0
---
cmk_base/prediction.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmk_base/prediction.py b/cmk_base/prediction.py
index bdcd7d4..dca1048 100644
--- a/cmk_base/prediction.py
+++ b/cmk_base/prediction.py
@@ -245,7 +245,7 @@ def _clean_predictions_dir(pred_dir, params):
if f.endswith(".info"):
info_file = os.path.join(pred_dir, f)
info = cmk.utils.prediction.retrieve_data_for_prediction(info_file, '')
- if info["params"]["period"] != params["period"]:
+ if info is None or info["params"]["period"] != params["period"]:
cmk.utils.prediction.clean_prediction_files(info_file[:-5], force=True)