|
35 | 35 | from cmk.base.plugins.agent_based.agent_based_api.v1 import * |
36 | 36 | from cmk.utils.exceptions import MKGeneralException |
37 | 37 |
|
38 | | -ROBOTMK_VERSION = 'v1.2.2' |
| 38 | +ROBOTMK_VERSION = 'v1.2.3' |
39 | 39 | DEFAULT_SVC_PREFIX = 'Robot Framework E2E $SUITEID$SPACE-$SPACE' |
40 | 40 | HTML_LOG_DIR = "%s/%s" % (os.environ['OMD_ROOT'], 'local/share/addons/robotmk') |
41 | 41 |
|
@@ -337,30 +337,19 @@ def check_robotmk(item, params, section): |
337 | 337 | for i in evaluate_robot_item(discovered_item, params_dict): |
338 | 338 | yield i |
339 | 339 | else: |
340 | | - # Keeping the following only for recalling.... |
341 | | - # A stale result should not return anything here. |
342 | | - # It's enough to have it alarmed by the Robotmk |
343 | | - # stale monitoring check (see Ref. N2UC9N) |
344 | | - pass |
345 | | - # overdue_sec = round( |
346 | | - # age.total_seconds() - root_suite['cache_time'], |
347 | | - # 1) |
348 | | - # yield ignore_robot_item(root_suite, last_end, |
349 | | - # overdue_sec) |
350 | | - |
351 | | - # We should not come here. Item cannot be found in parsed data. |
352 | | - # see PRO TIP: simple return if no data is found |
353 | | - # http://bit.ly/3epEcf3 |
| 340 | + ignore = ignore_robot_item(root_suite, last_end, age) |
| 341 | + yield ignore |
| 342 | + |
354 | 343 | return |
355 | 344 |
|
356 | | -def ignore_robot_item(root_suite, last_end, overdue_sec): |
357 | | - # TODO: (Perhaps make this configurable (OK/UNKNOWN)) |
| 345 | +def ignore_robot_item(root_suite, last_end, age): |
| 346 | + overdue_sec = round(age.total_seconds() - root_suite['cache_time'],1) |
358 | 347 | last_end_fmt = last_end.strftime('%Y-%m-%d %H:%M:%S') |
359 | 348 | out = "Result of suite '%s' is too old. " % root_suite['id'] + \ |
360 | 349 | "Last execution end: %s, " % last_end_fmt + \ |
361 | 350 | "overdue since %ss " % (overdue_sec) + \ |
362 | 351 | "(cache time: %ss)" % str(root_suite['cache_time']) |
363 | | - return 3, out |
| 352 | + return IgnoreResults(out) |
364 | 353 |
|
365 | 354 |
|
366 | 355 | def evaluate_robot_item(robot_item, params): |
|
0 commit comments