From 41800d1e3a6804674d3fc807d7a2993aec241f34 Mon Sep 17 00:00:00 2001 From: Jeremy Laine Date: Fri, 23 May 2008 09:37:14 +0000 Subject: oestats-client.bbclass: don't include bug number/tracker if empty --- classes/oestats-client.bbclass | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'classes/oestats-client.bbclass') diff --git a/classes/oestats-client.bbclass b/classes/oestats-client.bbclass index 25388f4636..968aa42c3b 100644 --- a/classes/oestats-client.bbclass +++ b/classes/oestats-client.bbclass @@ -118,7 +118,7 @@ def oestats_task(server, d, task, status): except: elapsed = 0 - # send the log for failures + # prepare files files = {} if status == 'Failed': logs = glob.glob("%s/log.%s.*" % (bb.data.getVar('T', d, True), task)) @@ -130,20 +130,25 @@ def oestats_task(server, d, task, status): 'content': file(log).read(), 'content-type': 'text/plain'} + # prepare report + vars = { + 'build': id, + 'package': bb.data.getVar('PN', d, True), + 'version': bb.data.getVar('PV', d, True), + 'revision': bb.data.getVar('PR', d, True), + 'depends': bb.data.getVar('DEPENDS', d, True), + 'task': task, + 'status': status, + 'time': str(elapsed)} + bug_number = bb.data.getVar('OESTATS_BUG_NUMBER', d, True) + bug_tracker = bb.data.getVar('OESTATS_BUG_TRACKER', d, True) + if bug_number and bug_tracker: + vars['bug_number'] = bug_number + vars['bug_tracker'] = bug_tracker + # send report try: - response = oestats_send(server, "/tasks/", { - 'build': id, - 'package': bb.data.getVar('PN', d, True), - 'version': bb.data.getVar('PV', d, True), - 'revision': bb.data.getVar('PR', d, True), - 'depends': bb.data.getVar('DEPENDS', d, True), - 'task': task, - 'status': status, - 'time': str(elapsed), - 'bug_number': bb.data.getVar('OESTATS_BUG_NUMBER', d, True) or "", - 'bug_tracker': bb.data.getVar('OESTATS_BUG_TRACKER', d, True) or "", - }, files) + response = oestats_send(server, "/tasks/", vars, files) except: bb.note("oestats: error sending task, disabling stats") oestats_setid(d, "") -- cgit v1.2.3