[Python-jenkins-developers] [Bug 1853147] Re: create_node doesn't work

2020-08-31 Thread John Stockmann
I've also been blocked by this issue.  I tried replacing
"computer/doCreateItem" with "computer/new" inside of my
jenkins\__init__.py but now I fail with a node doesn't exist exception
because the node doesn't get created.  "computer/new" is where I
manually build a node.

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

Title:
  create_node doesn't work

Status in Python Jenkins:
  New

Bug description:
  >>> import jenkins
  >>> server=jenkins.Jenkins('http://esxserver:8080','python','***')
  >>> server.create_node('QAW19E16')
  Traceback (most recent call last):
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\jenkins\__init__.py",
 line 575, in jenkins_request
  self._request(req))
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\jenkins\__init__.py",
 line 535, in _response_handler
  response.raise_for_status()
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\models.py",
 line 940, in raise_for_status
  raise HTTPError(http_error_msg, response=self)
  requests.exceptions.HTTPError: 500 Server Error: Server Error for url: 
http://esxserver:8080/computer/doCreateItem

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
File "", line 1, in 
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\jenkins\__init__.py",
 line 1577, in create_node
  'POST', self._build_url(CREATE_NODE, locals()), data=params)
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\jenkins\__init__.py",
 line 556, in jenkins_open
  return self.jenkins_request(req, add_crumb, resolve_auth).text
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\jenkins\__init__.py",
 line 586, in jenkins_request
  raise JenkinsException(msg)
  jenkins.JenkinsException: Error in request. Possibly authentication failed 
[500]: Server Error



  


  
  Jenkins [Jenkins]var isRunAsTest=false; var rootURL=""; 
var resURL="/static/e8c55eca";crumb.init("Jenkins-Crumb", 
"efd5ccc6e794b2d7efa7f677e5bb993f");var 
Q=jQuery.noConflict()Skip to content log 
in https://jenkins.io/redirect/search-box";>createSearchBox("/search/");Jenkinshttps://jenkins.io/"; class="task-icon-link"> https://jenkins.io/"; class="task-link">Jenkins projecthttps://jenkins.io/redirect/report-an-issue"; 
class="task-icon-link"> https://jenkins.io/redirect/report-an-issue"; class="task-link">Bug 
trackerhttps://jenkins.io/redirect/mailing-lists"; class="task-icon-link"> https://jenkins.io/redirect/mailing-lists"; 
class="task-link">Mailing Listshttps://twitter.com/jenkinsci"; class="task-icon-link"> https://twitter.com/jenkinsci"; class="task-link">Twitter: 
@jenkinsci Oops!A problem occurred while processing the request.
  Please check https://jenkins.io/redirect/issue-tracker";>our 
bug tracker to see if a similar problem has already been reported.
  If it is already reported, please vote and put a comment on it to let 
us gauge the impact of the problem.
  If you think this is a new issue, please file a new issue.
  When you file an issue, make sure to add the entire stack trace, 
along with the version of Jenkins and relevant plugins.
  https://jenkins.io/redirect/users-mailing-list";>The users 
list might be also useful in understanding what has happened.Stack 
tracejava.lang.NullPointerException
  at 
org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.hash(ScriptApproval.java:362)
  at 
org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.configuring(ScriptApproval.java:414)
  at hudson.slaves.CommandLauncher.(CommandLauncher.java:79)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown 
Source)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown 
Source)
  at java.lang.reflect.Constructor.newInstance(Unknown Source)
  at 
org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:529)
  at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:784)
  at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:83)
  at 
org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:678)
  at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:478)
  at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:474)
  at hudson.model.Descriptor.newInstance(Descriptor.java:593)
  Caused: java.lang.Error: Failed to instantiate class 
hudson.slaves.CommandLauncher from 
{"stapler-class":"hudson.slaves.CommandLauncher"}
  at hudson.model.Descriptor.newIn

[Python-jenkins-developers] [Bug 1853147] Re: create_node doesn't work

2020-08-31 Thread John Stockmann
I followed the instructions on this page and was able to find a fix on
my end: https://support.cloudbees.com/hc/en-us/articles/115003896171
-Creating-node-with-Rest-API-and-ManuallyTrustedKeyVerificationStrategy

The fix was to change jenkins\__init__.py line 90 from LAUNCHER_COMMAND
= 'hudson.slaves.CommandLauncher' to LAUNCHER_COMMAND =
'hudson.slaves.JNLPLauncher'.

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

Title:
  create_node doesn't work

Status in Python Jenkins:
  New

Bug description:
  >>> import jenkins
  >>> server=jenkins.Jenkins('http://esxserver:8080','python','***')
  >>> server.create_node('QAW19E16')
  Traceback (most recent call last):
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\jenkins\__init__.py",
 line 575, in jenkins_request
  self._request(req))
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\jenkins\__init__.py",
 line 535, in _response_handler
  response.raise_for_status()
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\models.py",
 line 940, in raise_for_status
  raise HTTPError(http_error_msg, response=self)
  requests.exceptions.HTTPError: 500 Server Error: Server Error for url: 
http://esxserver:8080/computer/doCreateItem

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
File "", line 1, in 
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\jenkins\__init__.py",
 line 1577, in create_node
  'POST', self._build_url(CREATE_NODE, locals()), data=params)
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\jenkins\__init__.py",
 line 556, in jenkins_open
  return self.jenkins_request(req, add_crumb, resolve_auth).text
File 
"C:\Users\myuser\AppData\Local\Programs\Python\Python37\lib\site-packages\jenkins\__init__.py",
 line 586, in jenkins_request
  raise JenkinsException(msg)
  jenkins.JenkinsException: Error in request. Possibly authentication failed 
[500]: Server Error



  


  
  Jenkins [Jenkins]var isRunAsTest=false; var rootURL=""; 
var resURL="/static/e8c55eca";crumb.init("Jenkins-Crumb", 
"efd5ccc6e794b2d7efa7f677e5bb993f");var 
Q=jQuery.noConflict()Skip to content log 
in https://jenkins.io/redirect/search-box";>createSearchBox("/search/");Jenkinshttps://jenkins.io/"; class="task-icon-link"> https://jenkins.io/"; class="task-link">Jenkins projecthttps://jenkins.io/redirect/report-an-issue"; 
class="task-icon-link"> https://jenkins.io/redirect/report-an-issue"; class="task-link">Bug 
trackerhttps://jenkins.io/redirect/mailing-lists"; class="task-icon-link"> https://jenkins.io/redirect/mailing-lists"; 
class="task-link">Mailing Listshttps://twitter.com/jenkinsci"; class="task-icon-link"> https://twitter.com/jenkinsci"; class="task-link">Twitter: 
@jenkinsci Oops!A problem occurred while processing the request.
  Please check https://jenkins.io/redirect/issue-tracker";>our 
bug tracker to see if a similar problem has already been reported.
  If it is already reported, please vote and put a comment on it to let 
us gauge the impact of the problem.
  If you think this is a new issue, please file a new issue.
  When you file an issue, make sure to add the entire stack trace, 
along with the version of Jenkins and relevant plugins.
  https://jenkins.io/redirect/users-mailing-list";>The users 
list might be also useful in understanding what has happened.Stack 
tracejava.lang.NullPointerException
  at 
org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.hash(ScriptApproval.java:362)
  at 
org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.configuring(ScriptApproval.java:414)
  at hudson.slaves.CommandLauncher.(CommandLauncher.java:79)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown 
Source)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown 
Source)
  at java.lang.reflect.Constructor.newInstance(Unknown Source)
  at 
org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:529)
  at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:784)
  at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:83)
  at 
org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:678)
  at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:478)
  at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:474)
  at hudson.model.Descriptor.newInstance(Descriptor.java:593)
  Caused: java.lang.Error: Failed to instantiate class 
hudson.slaves.CommandLauncher