public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH] report-error: Handle the case no logfile exists
@ 2014-12-20 11:20 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2014-12-20 11:20 UTC (permalink / raw)
  To: openembedded-core

If the task fails early, no error log may exist. Currently we crash in
that case, this handles the situation more gracefully.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 5fe2355..8b30422 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -44,11 +44,14 @@ python errorreport_handler () {
             task = e.task
             taskdata={}
             log = e.data.getVar('BB_LOGFILE', True)
-            logFile = open(log, 'r')
             taskdata['package'] = e.data.expand("${PF}")
             taskdata['task'] = task
-            taskdata['log'] = logFile.read()
-            logFile.close()
+            if log:
+                logFile = open(log, 'r')
+                taskdata['log'] = logFile.read()
+                logFile.close()
+            else:
+                taskdata['log'] = "No Log"
             jsondata = json.loads(errorreport_getdata(e))
             jsondata['failures'].append(taskdata)
             errorreport_savedata(e, jsondata, "error-report.txt")




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-20 11:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-20 11:20 [PATCH] report-error: Handle the case no logfile exists Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox