Comment 5 for bug 1781381

Revision history for this message
Gildas Fargeas (gfargeas) wrote :

It seems more appropriate to update the request object instead. With your patch, you'll ignore added headers(including the crumb).
To prevent this, just change the request instanciation for the delete_build call (wipeout_job_workspace has the same call so it fixes that as well):

diff --git a/jenkins/__init__.py b/jenkins/__init__.py
index 620ce14..0691f2a 100755
--- a/jenkins/__init__.py
+++ b/jenkins/__init__.py
@@ -1469,7 +1469,7 @@ class Jenkins(object):
         """
         folder_url, short_name = self._get_job_folder(name)
         self.jenkins_open(requests.Request('POST',
- self._build_url(DELETE_BUILD, locals()), b''))
+ self._build_url(DELETE_BUILD, locals())))

     def wipeout_job_workspace(self, name):
         """Wipe out workspace for given Jenkins job.
@@ -1479,7 +1479,7 @@ class Jenkins(object):
         folder_url, short_name = self._get_job_folder(name)
         self.jenkins_open(requests.Request('POST',
                           self._build_url(WIPEOUT_JOB_WORKSPACE,
- locals()), b''))
+ locals())))

     def get_running_builds(self):
         '''Return list of running builds.