From 0db6e09ccefb35bb03ce9c161d479c7c27992a42 Mon Sep 17 00:00:00 2001 From: gabriele renzi Date: Mon, 23 Feb 2015 11:18:26 +0100 Subject: [PATCH 1/2] build status STARTED causes error there are 2 bugs, one is that phase == 'STARTED' should plausibly be handled the same way as phase == 'STARTED', the other is that line #199 causes a KeyError when that happens, and should probably be using dict.get as line 196 does --- sevabot/frontend/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sevabot/frontend/api.py b/sevabot/frontend/api.py index 808ec9c..2c80754 100644 --- a/sevabot/frontend/api.py +++ b/sevabot/frontend/api.py @@ -193,10 +193,10 @@ def compose(self): logger.error("Jenkins did not post a valid HTTP POST payload. Check the logs for further info.") return "Jenkins bad notification: Could not read HTTP POST data" # Filter out completed status, lots of unneeded noise - if payload['build']['phase'] != 'COMPLETED': + if payload['build']['phase'] != 'COMPLETED' && payload['build']['phase'] != 'STARTED': if payload['build'].get('status') == 'SUCCESS': msg = u'Project: %s build #%d %s Status: %s - (sun) - %s\n' % (payload['name'], payload['build']['number'], payload['build']['phase'], payload['build']['status'], payload['build']['full_url']) - elif payload['build']['status'] == 'FAILURE': + elif payload['build'].get('status') == 'FAILURE': msg = u'Project: %s build #%d %s Status: %s - (rain) - %s\n' % (payload['name'], payload['build']['number'], payload['build']['phase'], payload['build']['status'], payload['build']['full_url']) else: msg = u'Project: %s build #%d %s Status: %s - - %s\n' % (payload['name'], payload['build']['number'], payload['build']['phase'], payload['build']['status'], payload['build']['full_url']) From 22f3711c2f3b2d9628b6801290fcb8461efda6e4 Mon Sep 17 00:00:00 2001 From: Gabriele Renzi Date: Mon, 23 Feb 2015 11:35:17 +0100 Subject: [PATCH 2/2] python is not ruby --- sevabot/frontend/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sevabot/frontend/api.py b/sevabot/frontend/api.py index 2c80754..0d37f97 100644 --- a/sevabot/frontend/api.py +++ b/sevabot/frontend/api.py @@ -193,7 +193,7 @@ def compose(self): logger.error("Jenkins did not post a valid HTTP POST payload. Check the logs for further info.") return "Jenkins bad notification: Could not read HTTP POST data" # Filter out completed status, lots of unneeded noise - if payload['build']['phase'] != 'COMPLETED' && payload['build']['phase'] != 'STARTED': + if payload['build']['phase'] != 'COMPLETED' and payload['build']['phase'] != 'STARTED': if payload['build'].get('status') == 'SUCCESS': msg = u'Project: %s build #%d %s Status: %s - (sun) - %s\n' % (payload['name'], payload['build']['number'], payload['build']['phase'], payload['build']['status'], payload['build']['full_url']) elif payload['build'].get('status') == 'FAILURE':