← Back to team overview

python-jenkins-developers team mailing list archive

[Bug 1500898] Re: create_node() raises HTTP Error 400 Bad Request

 

We encountered this today using the latest (4.11) version.

The culprit is how the URL is parsed. Jenkins requires 3 queryargs:
'json', 'name', and 'type'. But the url part is getting created as a big
dictionary which causes this (truncated for brevity):

    https://jenkins.ceph.com/computer/doCreateItem?{'json':  ...

When it should really be:

    https://jenkins.ceph.com/computer/doCreateItem?json=...

This is caused by:

         self.jenkins_open(Request(
             self._build_url(CREATE_NODE, params), b'')) 

Where "params" is a big dictionary of options.

On previous versions where this worked it was actually:

        self.jenkins_open(Request(
            self.server + CREATE_NODE % urlencode(params)), b'')

Which correctly parses the query args and constructs the URL that
Jenkins is expecting.

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

Title:
  create_node() raises HTTP Error 400 Bad Request

Status in Python Jenkins:
  New

Bug description:
  after update to version 0.4.9 create_node() function raises error

  >>> j.create_node(name="testest",numExecutors=1,nodeDescription='',remoteFS="/home/vagrant/jenkins")
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "C:\Users\galexandrov\AppData\Local\Programs\Python\Python35\lib\site-packages\jenkins\__init__.py", line 1156, in create_node
      self._build_url(CREATE_NODE, params), b''))
    File "C:\Users\galexandrov\AppData\Local\Programs\Python\Python35\lib\site-packages\jenkins\__init__.py", line 341, in jenkins_open
      response = urlopen(req, timeout=self.timeout).read()
    File "C:\Users\galexandrov\AppData\Local\Programs\Python\Python35\lib\urllib\request.py", line 162, in urlopen
      return opener.open(url, data, timeout)
    File "C:\Users\galexandrov\AppData\Local\Programs\Python\Python35\lib\urllib\request.py", line 471, in open
      response = meth(req, response)
    File "C:\Users\galexandrov\AppData\Local\Programs\Python\Python35\lib\urllib\request.py", line 581, in http_response

      'http', request, response, code, msg, hdrs)
    File "C:\Users\galexandrov\AppData\Local\Programs\Python\Python35\lib\urllib\request.py", line 509, in error
      return self._call_chain(*args)
    File "C:\Users\galexandrov\AppData\Local\Programs\Python\Python35\lib\urllib\request.py", line 443, in _call_chain
      result = func(*args)
    File "C:\Users\galexandrov\AppData\Local\Programs\Python\Python35\lib\urllib\request.py", line 589, in http_error_default
      raise HTTPError(req.full_url, code, msg, hdrs, fp)
  urllib.error.HTTPError: HTTP Error 400: Bad Request

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


References