← Back to team overview

python-jenkins-developers team mailing list archive

[Bug 1698815] Re: get_jobs fails when space in folder name

 

Reviewed:  https://review.openstack.org/504536
Committed: https://git.openstack.org/cgit/openstack/python-jenkins/commit/?id=16007e01858cc5d36afdc31d22b5644f91a1f935
Submitter: Zuul
Branch:    master

commit 16007e01858cc5d36afdc31d22b5644f91a1f935
Author: Andrew Mellen <andrew_mellen@xxxxxxxxxx>
Date:   Fri Sep 15 18:46:35 2017 -0400

    Sanitize url in get_info() function
    
    Change-Id: I540f6d636e277d0ad230f844d2db6220edfb672f
    Closes-Bug: #1698815


** Changed in: python-jenkins
       Status: In Progress => Fix Released

-- 
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/1698815

Title:
  get_jobs fails when space in folder name

Status in Python Jenkins:
  Fix Released

Bug description:
  With cloudbees folders if you have a folder with a space in it, you
  will get the following error

  >>> server = jenkins.Jenkins('http://jenkinsmaster',
  username='username', password='password')

  >>> server.get_jobs(folder_depth=2)
  Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/jenkins/__init__.py", line 551, in get_info
      Request(self._build_url(url))
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/jenkins/__init__.py", line 431, in jenkins_open
      response = urlopen(req, timeout=self.timeout).read()
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
      return opener.open(url, data, timeout)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 532, in open
      response = meth(req, response)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 642, in http_response
      'http', request, response, code, msg, hdrs)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 570, in error
      return self._call_chain(*args)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
      result = func(*args)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 650, in http_error_default
      raise HTTPError(req.full_url, code, msg, hdrs, fp)
  urllib.error.HTTPError: HTTP Error 400: Bad request

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/jenkins/__init__.py", line 765, in get_jobs
      return self.get_all_jobs(folder_depth=folder_depth)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/jenkins/__init__.py", line 825, in get_all_jobs
      query=JOBS_QUERY)['jobs']))
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/jenkins/__init__.py", line 555, in get_info
      % self.server)
  jenkins.BadHTTPException: Error communicating with server[http://jenkinsmaster]

To manage notifications about this bug go to:
https://bugs.launchpad.net/python-jenkins/+bug/1698815/+subscriptions


References