aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/generator_alerts.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2019-04-11 14:28:00 +0200
committerTibor Frank <tifrank@cisco.com>2019-04-15 10:41:52 +0200
commit18422fd2221c2474f07450280a7af1a06b1c2207 (patch)
tree44eb1c37482cd24214929d43c80139fda5d40440 /resources/tools/presentation/generator_alerts.py
parent5899ac744eb5f722f53151c98e5acfdbdf678d0c (diff)
Alerts: Change the error message
Change-Id: I0fcd6ffaf24de0f6ce95eaba3d591eddf3f16b33 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/generator_alerts.py')
-rw-r--r--resources/tools/presentation/generator_alerts.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/resources/tools/presentation/generator_alerts.py b/resources/tools/presentation/generator_alerts.py
index b106d9589a..1b40dbbbf9 100644
--- a/resources/tools/presentation/generator_alerts.py
+++ b/resources/tools/presentation/generator_alerts.py
@@ -19,7 +19,7 @@ from email.mime.multipart import MIMEMultipart
from os.path import isdir
from collections import OrderedDict
-from utils import execute_command
+from utils import get_last_completed_build_number
from errors import PresentationError
@@ -71,8 +71,10 @@ class Alerting(object):
# Implemented alerts:
self._ALERTS = ("failed-tests", )
+ self._spec = spec
+
try:
- self._spec = spec.alerting
+ self._spec_alert = spec.alerting
except KeyError as err:
raise AlertingError("Alerting is not configured, skipped.",
repr(err),
@@ -81,7 +83,7 @@ class Alerting(object):
self._path_failed_tests = spec.environment["paths"]["DIR[STATIC,VPP]"]
# Verify and validate input specification:
- self.configs = self._spec.get("configurations", None)
+ self.configs = self._spec_alert.get("configurations", None)
if not self.configs:
raise AlertingError("No alert configuration is specified.")
for config_type, config_data in self.configs.iteritems():
@@ -104,7 +106,7 @@ class Alerting(object):
raise AlertingError("Alert of type '{0}' is not implemented.".
format(config_type))
- self.alerts = self._spec.get("alerts", None)
+ self.alerts = self._spec_alert.get("alerts", None)
if not self.alerts:
raise AlertingError("No alert is specified.")
for alert, alert_data in self.alerts.iteritems():
@@ -303,8 +305,16 @@ class Alerting(object):
build, version, nr, failed_tests = \
self._get_compressed_failed_tests(alert, test_set)
if build is None:
- text += "\n\nNo data for the test set '{set}'.\n".\
- format(set=test_set)
+ ret_code, build_nr, _ = get_last_completed_build_number(
+ self._spec.environment["urls"]["URL[JENKINS,CSIT]"],
+ alert["urls"][idx].split('/')[-1])
+ if ret_code != 0:
+ build_nr = ''
+ text += "\n\nNo input data available for '{set}'. See CSIT " \
+ "build {link}/{build} for more information.\n".\
+ format(set='-'.join(test_set.split('-')[-2:]),
+ link=alert["urls"][idx],
+ build=build_nr)
continue
text += ("\n\n{topo}-{arch}, "
"{nr} tests failed, "