From a631b19d47f39c693c9f7c1953fe3085b6eb6376 Mon Sep 17 00:00:00 2001 From: Salim Fadhley Date: Sun, 30 Jun 2013 02:12:53 +0100 Subject: [PATCH] handle missing build objects slightly better --- jenkinsapi/invocation.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jenkinsapi/invocation.py b/jenkinsapi/invocation.py index 36c1a4c..f014ff2 100644 --- a/jenkinsapi/invocation.py +++ b/jenkinsapi/invocation.py @@ -96,8 +96,14 @@ class Invocation(object): def is_running(self): """ Returns True if this item is executing now - """ - return self.get_build().is_running() + Returns False if this item has completed + or has not yet executed. + """ + try: + return self.get_build().is_running() + except KeyError: + # This item has not yet executed + return False def is_queued_or_running(self): return self.is_queued() or self.is_running() -- 2.34.1