I honestly don't know. We were using an older version of Jenkins at the time, and it's possible that they've changed something in Jenkins that would work around the issue. I'm afraid I don't have any time to look into it today, but here's the code I overrode with:
def cancel_queue(self, number):
"""
Cancel a queued build. The underlying method has a bug that
renders it non-functional (it tries to do a GET request, when
Jenkins wants a POST). This corrects the error by passing
``data`` to the urllib2.Request constructor.
I honestly don't know. We were using an older version of Jenkins at the time, and it's possible that they've changed something in Jenkins that would work around the issue. I'm afraid I don't have any time to look into it today, but here's the code I overrode with:
def cancel_queue(self, number):
"""
Cancel a queued build. The underlying method has a bug that
renders it non-functional (it tries to do a GET request, when
Jenkins wants a POST). This corrects the error by passing
``data`` to the urllib2.Request constructor.
:param number: The queue ID number to cancel.
"""
req = urllib2. Request( self.server + jenkins. CANCEL_ QUEUE %
{'number' : number}, data='',
headers= {'Referer' : self.server})
self.jenkins_ open(req)
In any case, the above *does* work, and was necessary because, in my experimentation at the time, I could not get a queued job to be canceled.