Escaping required in get_all_jobs() for Jenkins 2.138

Bug #1794133 reported by Petr Zahradnik
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Python Jenkins
New
Undecided
Unassigned

Bug Description

while using python-jenkins via jenkins-jobs builder against Jenkins 2.138.1 it fails with:

jenkins.BadHTTPException: Error communicating with server[http://jenkins-server/]

further investigation reveals that when get_all_jobs() gets called following url is fetched from Jenkins:

http://jenkins-server/api/json?tree=jobs[url,color,name,jobs]

which fails with http 400.
The request succeeds if the square brackets are correctly escaped e.g. like this:

http://jenkins-server/api/json?tree=jobs%5Burl,color,name,jobs%5D

this may apply to additional API calls as well.

Revision history for this message
Petr Zahradnik (pezinek) wrote :
Revision history for this message
Trevor McCasland (twm2016) wrote :

Hi Petr, I'm not active on this project, but I do like it and use it sometimes, just a couple comments below to help you out with this contribution. :)

1. According to the README, patches should be submitted in gerrit, https://github.com/openstack/python-jenkins#developers

2. do all square brackets need to be escaped or why is it only JOBS_QUERY?
explanation below:
  From your suggested fix there is another square bracket not being escaped, ALL_BUILDS = '%(folder_url)sjob/%(short_name)s/api/json?tree=allBuilds[number,url]'

  According to your bug description, this should also be, ALL_BUILDS = '%(folder_url)sjob/%(short_name)s/api/json?tree=allBuilds%5Dnumber,url%5D'

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.