From 309175d101ebad213015d16e58942eaa5314d5ac Mon Sep 17 00:00:00 2001 From: SU Sheng Loong + CHUA Jie Sheng Date: Thu, 7 Apr 2016 16:00:13 +0800 Subject: [PATCH] Prevent KeyError 'result' There is a specific point of time where Go API does not return 'result' in the JSON response body. --- gocd_cli/commands/pipeline/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gocd_cli/commands/pipeline/__init__.py b/gocd_cli/commands/pipeline/__init__.py index 5266774..df17120 100644 --- a/gocd_cli/commands/pipeline/__init__.py +++ b/gocd_cli/commands/pipeline/__init__.py @@ -102,7 +102,7 @@ def _convert_to_dict(self, args): def _stages_finished(self, response): for stage in response['stages']: - if stage['result'] not in self.pipeline.final_results: + if stage.get('result') not in self.pipeline.final_results: return False return True