get_info() ignores query argument
Bug #1771319 reported by
ercpe
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Python Jenkins |
New
|
Undecided
|
Unassigned |
Bug Description
With python-jenkins >= 1.0.0, the parameter 'query' of the get_info() method is ignored:
url = '/'.join((item, INFO)).lstrip('/')
url = quote(url)
if query:
url += query
try:
return json.loads(
))
except (req_exc.HTTPError, BadStatusLine):
....
The query parameter is used to construct the url which isn't passed to the actual request. As a result, all calls to get_info() return only the mninimal job fields.
To post a comment you must log in.
This also effects any other function calls that rely on queries passed to get_info - which after a quick ctrl+f appears to be just get_all_jobs() atm.
Since _build_url() is used for constructing the url with base, it should be a relatively simple fix of replacing 'INFO' with 'url' to get this functioning as described. It might also be good to set url = INFO before checking for the existence of item or query to keep the current functionality available as a call to get_info() without any params.
I'll work on a PR for this later if I have time. It's such a simple fix but has caused headaches for me over the past 2 days after finding that get_all_jobs() didn't actually work as advertised.
ercpe@ - you can work around this by making your own call to your instance with your query:
j = jenkins. Jenkins( ...) open(jenkins. requests. Request( 'GET', j._build_url(url)))
query = '?tree=views[name]'
url = jenkins.INFO + QUERY
results = j.jenkins_