]> code.ossystems Code Review - openembedded-core.git/commitdiff
report-error: Handle the case no logfile exists
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 20 Dec 2014 11:20:33 +0000 (11:20 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 6 Jan 2015 14:13:04 +0000 (14:13 +0000)
If the task fails early, no error log may exist. Currently we crash in
that case, this handles the situation more gracefully.

(From OE-Core rev: 1e6bfcab47f532677f87683ba2f5e5fb905e9ba5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
meta/classes/report-error.bbclass

index 5fe2355842ce008c14f0dac0489b754f1db8c407..8b30422edfa7e06e1744e98b57b1a94f1f32993c 100644 (file)
@@ -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")