- if spec.output["output"] == "report":
- generate_report(args.release, spec)
- logging.info("Successfully finished.")
- ret_code = 0
- elif spec.output["output"] == "CPTA":
- ret_code = generate_cpta(spec, data)
- logging.info("Successfully finished.")
- else:
- logging.critical("The output '{0}' is not supported.".
- format(spec.output["output"]))
- ret_code = 1
-
- except (KeyError, ValueError, PresentationError) as err:
- logging.info("Finished with an error.")
- logging.critical(str(err))
- ret_code = 1
- except Exception as err:
- logging.info("Finished with an unexpected error.")
- logging.critical(str(err))
- ret_code = 1
+ if spec.output[u"output"] == u"report":
+ generate_report(args.release, spec, args.week)
+ elif spec.output[u"output"] == u"CPTA":
+ sys.stdout.write(generate_cpta(spec, data))
+ try:
+ alert = Alerting(spec)
+ alert.generate_alerts()
+ except AlertingError as err:
+ logging.warning(repr(err))
+
+ logging.info(u"Successfully finished.")
+ ret_code = 0
+
+ except AlertingError as err:
+ logging.critical(f"Finished with an alerting error.\n{repr(err)}")
+ except PresentationError as err:
+ logging.critical(f"Finished with an PAL error.\n{repr(err)}")
+ except (KeyError, ValueError) as err:
+ logging.critical(f"Finished with an error.\n{repr(err)}")