[koji-wrapper] Only parse output on success

If Koji fails runroot task for some reason, the output will most likely
not have the required format and will crash Pungi.

Pagure: #140
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-02-10 09:06:15 +01:00
parent 8e5e893e5c
commit aec57dc72b
2 changed files with 12 additions and 5 deletions

View file

@ -82,7 +82,7 @@ class KojiWrapper(object):
task_id = None
retcode, output = run(command, can_fail=True, logfile=log_file)
if "--task-id" in command:
if retcode == 0 and "--task-id" in command:
task_id = int(output.splitlines()[0])
output_ends_with_eol = output.endswith("\n")
output = "\n".join(output.splitlines()[1:])