During the running the mass-rebuild for Fedora/s390x I have found that
it would be useful if koji-cli could return also the reason for failed
task. Same information can be seen in taskinfo web interface. Usually
build failure with details in root.log means some missing/broken
dependency in buildroot, details in build.log mean a real failure where
a manual inspection is needed, etc.

The result is in the attached patch.


Dan

>From 9abcbc2a05caaa1b891297b61cad91dc8508b876 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
Date: Fri, 28 May 2010 17:44:57 +0200
Subject: [PATCH] print reason of failed task in taskinfo
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It is useful to output also the reason of failed task in the output of
taskinfo as it allows further action depending on the cause.

Signed-off-by: Dan Horák <[email protected]>
---
 cli/koji |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/cli/koji b/cli/koji
index 3c1c109..8d0754c 100755
--- a/cli/koji
+++ b/cli/koji
@@ -3261,6 +3261,21 @@ def _printTaskInfo(session, task_id, level=0, recurse=True, verbose=True):
         for filename in output:
             print "%s %s/%s" % (indent, files_dir, filename)
 
+    if verbose and info['state'] == koji.TASK_STATES['FAILED']:
+        try:
+            result = session.getTaskResult(task_id)
+            excClass = None
+        except:
+            excClass, exc = sys.exc_info()[:2]
+            result = exc
+            excClass = excClass
+            # clear the exception, since we're just using
+            # it for display purposes
+            sys.exc_clear()
+
+	if excClass:
+	    print "%s: %s" % (excClass.__name__, result)
+
     # white space
     sys.stdout.write("\n")
 
-- 
1.6.6.1

--
buildsys mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/buildsys

Reply via email to