[OpenStack-Infra] I get a HTTP Error 405 after nodepool build a new node and try to register the node as jenkins slaves.

Xinliang Liu xinliang.liu at linaro.org
Mon Jun 26 09:26:41 UTC 2017


Hi,

On 26 June 2017 at 16:42, 沈敏江 <shenminjiang at fusionstack.cn> wrote:

> Hi,
> I am trying to set up a CI environment, and get some troubles. I follow
> the guild 'https://docs.openstack.org/infra/openstackci/third_party_
> ci.html', and in the end of step 'start nodepool' I get a HTTP Error 405,
> following is the error log in /var/log/nodepool/nodepool.log:
> ```
> 2017-06-22 10:53:08,712 INFO nodepool.NodeLauncher: Node id: 469 is ready
> 2017-06-22 10:53:08,889 ERROR nodepool.NodeLauncher: HTTPError launching
> node id: 469 in provider: local_01 error:
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/dist-packages/nodepool/nodepool.py",
> line 426, in _run
>     dt = self.launchNode(session)
>   File "/usr/local/lib/python2.7/dist-packages/nodepool/nodepool.py",
> line 581, in launchNode
>     self.createJenkinsNode()
>   File "/usr/local/lib/python2.7/dist-packages/nodepool/nodepool.py",
> line 606, in createJenkinsNode
>     jenkins.createNode(**args)
>   File "/usr/local/lib/python2.7/dist-packages/nodepool/jenkins_manager.py",
> line 112, in createNode
>     return self.submitTask(CreateNodeTask(**args))
>   File "/usr/local/lib/python2.7/dist-packages/nodepool/task_manager.py",
> line 121, in submitTask
>     return task.wait()
>   File "/usr/local/lib/python2.7/dist-packages/nodepool/task_manager.py",
> line 57, in run
>     self.done(self.main(client))
>   File "/usr/local/lib/python2.7/dist-packages/nodepool/jenkins_manager.py",
> line 49, in main
>     jenkins.create_node(**args)
>   File "/usr/local/lib/python2.7/dist-packages/nodepool/myjenkins.py",
> line 139, in create_node
>     self.server + CREATE_NODE % urlparse.urlencode(params)))
>   File "/usr/local/lib/python2.7/dist-packages/jenkins/__init__.py", line
> 453, in jenkins_open
>     response = urlopen(req, timeout=self.timeout).read()
>   File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
>     return _opener.open(url, data, timeout)
>   File "/usr/lib/python2.7/urllib2.py", line 410, in open
>     response = meth(req, response)
>   File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
>     'http', request, response, code, msg, hdrs)
>   File "/usr/lib/python2.7/urllib2.py", line 448, in error
>     return self._call_chain(*args)
>   File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
>     result = func(*args)
>   File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
>     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> HTTPError: HTTP Error 405: Method Not Allowed
> 2017-06-22 10:53:09,976 INFO nodepool.NodePool: Deleted jenkins node id:
> 469
> ```
> I checked the code at the end of  file '/usr/local/lib/python2.7/
> dist-packages/nodepool/myjenkins.py', and found that the default http
> method is 'GET',  so I change the method to 'POST',and solved the problem.
> The changed code is following, where the commented code is the original
> code, and the rest are what I added.:
> ```
>         req = urlrequest.Request(
>              self.server + CREATE_NODE % urlparse.urlencode(params))
>         method = "POST"
>         req.get_method = lambda: method
>         self.jenkins_open(req)
>         #self.jenkins_open(urlrequest.Request(
>         #    self.server + CREATE_NODE % urlparse.urlencode(params)))
> ```
> So, my question is: Are there any config file that I can set the HTTP
> method to 'POST', or is there a bug needed to be fixed? I need your help,
> thanks!
>

​I met the same issue recently. This cause might ​be new jenkins (>=
2.46.1) change to POST method.
Add a empty body in the request will make it use POST method which should
fix this issue:
self.server + CREATE_NODE % urlparse.urlencode(params))) ==> self.server +
CREATE_NODE % urlparse.urlencode(params), b''))


Best,
xinliang


> Best regards
> Minjiang Shen
>
> _______________________________________________
> OpenStack-Infra mailing list
> OpenStack-Infra at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-infra/attachments/20170626/0a03fbca/attachment.html>


More information about the OpenStack-Infra mailing list