← Back to team overview

python-jenkins-developers team mailing list archive

[Bug 1771319] Re: get_info() ignores query argument

 

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(...)
query = '?tree=views[name]'
url = jenkins.INFO + QUERY
results = j.jenkins_open(jenkins.requests.Request('GET', j._build_url(url)))

-- 
You received this bug notification because you are a member of Python
Jenkins Developers, which is subscribed to Python Jenkins.
https://bugs.launchpad.net/bugs/1771319

Title:
  get_info() ignores query argument

Status in Python Jenkins:
  New

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(self.jenkins_open(
                  requests.Request('GET', self._build_url(INFO))
              ))
          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 manage notifications about this bug go to:
https://bugs.launchpad.net/python-jenkins/+bug/1771319/+subscriptions


References