On Mon, Mar 16, 2020 at 07:03:22PM +0100, Jan Tluka wrote:
The report part will now add result about the ping command status.
The evaluation part will be handled separately by configured Ping
evaluators.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/RecipeCommon/Ping/Recipe.py | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/lnst/RecipeCommon/Ping/Recipe.py b/lnst/RecipeCommon/Ping/Recipe.py
index 2ca86e07..128d7356 100644
--- a/lnst/RecipeCommon/Ping/Recipe.py
+++ b/lnst/RecipeCommon/Ping/Recipe.py
@@ -72,7 +72,7 @@ class PingTestAndEvaluate(BaseRecipe):
pingjob.kill()
for pingconf, pingjob in ping_array:
- result = pingjob.result
+ result = (pingjob.passed, pingjob.result)
results[pingconf] = result
return results
@@ -88,15 +88,20 @@ class PingTestAndEvaluate(BaseRecipe):
self.single_ping_report_and_evaluate(pingconf, result)
def single_ping_report_and_evaluate(self, ping_config, result):
+ self.single_ping_report(ping_config, result)
+
+ self.single_ping_evaluate(ping_config, result)
+
+ def single_ping_report(self, ping_config, result):
fmt = "From: <{0.client.hostid} ({0.client_bind})> To: " \
"<{0.destination.hostid} ({0.destination_address})>"
description = fmt.format(ping_config)
- if result["rate"] > 50:
- message = "Ping successful --- " + description
- self.add_result(True, message, result)
- else:
- message = "Ping unsuccessful --- " + description
- self.add_result(False, message, result)
+ message = "Ping result --- " + description
+ self.add_result(result[0], message, result[1])
I think the PASS/FAIL distinction here is unnecessary. If the Ping test
module returns with a FAIL, this is already automatically represented in
the results and will be shown in the summary.
This should just be a "passing" result object that reports what was
returned by the ping module - in other words... what was measured.
+
+ def single_ping_evaluate(self, ping_config, result):
+ for evaluator in ping_config.evaluators:
+ evaluator.evaluate_results(self, result[1])
def _generate_ping_kwargs(self, ping_config):
kwargs = dict(dst=ping_config.destination_address,
--
2.21.1
_______________________________________________
LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...