From: Bradley Harris Date: Tue, 9 Oct 2012 17:05:10 +0000 (-0400) Subject: Job API may not include in progress build in the 'builds' array. Use URL from 'lastB... X-Git-Tag: v0.2.23~273^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8fdf6cddf1f29124ce6dd67908b474da8b9ebfc;p=tools%2Fpython-jenkinsapi.git Job API may not include in progress build in the 'builds' array. Use URL from 'lastBuild' instead. --- diff --git a/jenkinsapi/job.py b/jenkinsapi/job.py index 2dfe279..d169f76 100644 --- a/jenkinsapi/job.py +++ b/jenkinsapi/job.py @@ -150,8 +150,9 @@ class Job(JenkinsBase): """ Get the last build """ - bn = self.get_last_buildnumber() - return self.get_build( bn ) + buildinfo = self._data["lastBuild"] + return Build( buildinfo["url"], buildinfo["number"], job=self ) + def get_last_build_or_none(self): """ @@ -159,7 +160,7 @@ class Job(JenkinsBase): """ bn = self.get_last_buildnumber() if bn is not None: - return self.get_build(bn) + return self.get_last_build() def get_last_completed_build( self ): """