If Ping test does not succeed, the result data does not contain the 'rate'
key and would fail with a traceback. This patch handles this situation
and creates a fail result with explanatory message.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/RecipeCommon/Ping/Evaluators/RatePingEvaluator.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lnst/RecipeCommon/Ping/Evaluators/RatePingEvaluator.py
b/lnst/RecipeCommon/Ping/Evaluators/RatePingEvaluator.py
index 6ed7d02f..365329f9 100644
--- a/lnst/RecipeCommon/Ping/Evaluators/RatePingEvaluator.py
+++ b/lnst/RecipeCommon/Ping/Evaluators/RatePingEvaluator.py
@@ -13,6 +13,10 @@ class RatePingEvaluator(BaseResultEvaluator):
)
def evaluate_results(self, recipe, result):
+ if result is None or 'rate' not in result:
+ recipe.add_result(False, 'Insufficient data for the evaluation of Ping
test')
+ return
+
result_status = True
ping_rate = int(result['rate'])
--
2.26.3