This doesn't work right due to some authorization issue:
Traceback (most recent call last):
File "/var/lib/jenkins/jenkins-launchpad-plugin-wfn/waitForNodeIdle.py", line 95, in <module>
sys.exit(main())
File "/var/lib/jenkins/jenkins-launchpad-plugin-wfn/waitForNodeIdle.py", line 87, in main
mark_offline(json_jenkins, args.url, args.node)
File "/var/lib/jenkins/jenkins-launchpad-plugin-wfn/waitForNodeIdle.py", line 46, in mark_offline
data = json_jenkins.get_json_data(offline_url, False)
File "/var/lib/jenkins/jenkins-launchpad-plugin-wfn/jsonjenkins.py", line 19, in get_json_data
data = urllib2.urlopen(url)
File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 406, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 444, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden
It's the call to load http://{server}/computer/{node}/toggleOffline which works fine when triggered from a browser. Yes, I know that get_json_data isn't the right call for this, but it's failing on the urlopen method, not the json.loads method.
The alternative solution is to call jenkins-cli from within the python script. I don't want to do that as it's mixing two APIs when a pure web based solution should work.
This doesn't work right due to some authorization issue: jenkins/ jenkins- launchpad- plugin- wfn/waitForNode Idle.py" , line 95, in <module> exit(main( )) jenkins/ jenkins- launchpad- plugin- wfn/waitForNode Idle.py" , line 87, in main offline( json_jenkins, args.url, args.node) jenkins/ jenkins- launchpad- plugin- wfn/waitForNode Idle.py" , line 46, in mark_offline get_json_ data(offline_ url, False) jenkins/ jenkins- launchpad- plugin- wfn/jsonjenkins .py", line 19, in get_json_data urlopen( url) python2. 7/urllib2. py", line 126, in urlopen python2. 7/urllib2. py", line 406, in open python2. 7/urllib2. py", line 519, in http_response python2. 7/urllib2. py", line 444, in error chain(* args) python2. 7/urllib2. py", line 378, in _call_chain python2. 7/urllib2. py", line 527, in http_error_default req.get_ full_url( ), code, msg, hdrs, fp)
Traceback (most recent call last):
File "/var/lib/
sys.
File "/var/lib/
mark_
File "/var/lib/
data = json_jenkins.
File "/var/lib/
data = urllib2.
File "/usr/lib/
return _opener.open(url, data, timeout)
File "/usr/lib/
response = meth(req, response)
File "/usr/lib/
'http', request, response, code, msg, hdrs)
File "/usr/lib/
return self._call_
File "/usr/lib/
result = func(*args)
File "/usr/lib/
raise HTTPError(
urllib2.HTTPError: HTTP Error 403: Forbidden
It's the call to load http://{server} /computer/ {node}/ toggleOffline which works fine when triggered from a browser. Yes, I know that get_json_data isn't the right call for this, but it's failing on the urlopen method, not the json.loads method.
The alternative solution is to call jenkins-cli from within the python script. I don't want to do that as it's mixing two APIs when a pure web based solution should work.