handle missing build objects slightly better
authorSalim Fadhley <sal@stodge.org>
Sun, 30 Jun 2013 01:12:53 +0000 (02:12 +0100)
committerSalim Fadhley <sal@stodge.org>
Sun, 30 Jun 2013 01:12:53 +0000 (02:12 +0100)
jenkinsapi/invocation.py

index 36c1a4c1ea92f77e1a41c1f5e9f9abeb5b1e3e16..f014ff2151b0eb50dad9572dcbaba98e7dd5dbe0 100644 (file)
@@ -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()