pungi-koji: Don't print traceback if error occurred.

If compose directory was created and logger setup properly traceback is
written in traceback.log. Otherwise traceback is printed on stdout.
This commit is contained in:
Pavol Babincak 2015-08-25 08:11:14 -04:00 committed by Daniel Mach
parent 9235844529
commit 853c27d1be

View File

@ -177,7 +177,11 @@ def main():
old_composes=opts.old_composes, koji_event=opts.koji_event, supported=opts.supported, logger=logger) old_composes=opts.old_composes, koji_event=opts.koji_event, supported=opts.supported, logger=logger)
kobo.log.add_file_logger(logger, compose.paths.log.log_file("global", "pungi.log")) kobo.log.add_file_logger(logger, compose.paths.log.log_file("global", "pungi.log"))
COMPOSE = compose COMPOSE = compose
try:
run_compose(compose) run_compose(compose)
except Exception, ex:
compose.log_error("Compose run failed: %s" % ex)
raise
def run_compose(compose): def run_compose(compose):
@ -335,6 +339,7 @@ if __name__ == "__main__":
open(tb_path, "w").write(kobo.tback.Traceback().get_traceback()) open(tb_path, "w").write(kobo.tback.Traceback().get_traceback())
else: else:
print("Exception: %s" % ex) print("Exception: %s" % ex)
raise
sys.stdout.flush() sys.stdout.flush()
sys.stderr.flush() sys.stderr.flush()
raise sys.exit(1)