python-jenkins-developers team mailing list archive
-
python-jenkins-developers team
-
Mailing list archive
-
Message #00430
[Bug 1682629] [NEW] get_running_builds returns error due to missing array.
Public bug reported:
In Jenkins-2.32.3, when running get_running_builds(), if an executor has
no executeables, it removes the array and replaces it with a string
"None", resulting in errors.
for executor in info['executors']:
executable = executor['currentExecutable']
if executable and 'PlaceholderTask' not in executable.get('_class', ''):
executor_number = executor['number']
build_number = executable['number']
url = executable['url']
m = re.search(r'/job/([^/]+)/.*', urlparse(url).path)
job_name = m.group(1)
builds.append({'name': job_name,
'number': build_number,
'url': url,
'node': node_name,
'executor': executor_number})
return builds
>>> info_master = server.get_node_info('(master)', depth=2)
As seen below, the currentExecutable key in the second executor (number:
1) is not an array, but rather a string "None", causing the build.append
to fail and return an error.
>>> info_master['executors']
[{u'likelyStuck': False, u'number': 0, u'idle': False, u'currentWorkUnit': {}, u'progress': 92, u'currentExecutable': {u'_class': u'org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$PlaceholderExecutable'}}, {u'likelyStuck': False, u'number': 1, u'idle': True, u'currentWorkUnit': None, u'progress': -1, u'currentExecutable': None}
ERROR:
>>> server.get_running_builds
<bound method Jenkins.get_running_builds of <jenkins.Jenkins object at 0x7f5965989c90>>
>>> server.get_running_builds90
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Jenkins' object has no attribute 'get_running_builds90'
>>> server.get_running_builds()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/jenkins/__init__.py", line 1151, in get_running_builds
build_number = executable['number']
KeyError: 'number'
>>>
** Affects: python-jenkins
Importance: Undecided
Status: New
--
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/1682629
Title:
get_running_builds returns error due to missing array.
Status in Python Jenkins:
New
Bug description:
In Jenkins-2.32.3, when running get_running_builds(), if an executor
has no executeables, it removes the array and replaces it with a
string "None", resulting in errors.
for executor in info['executors']:
executable = executor['currentExecutable']
if executable and 'PlaceholderTask' not in executable.get('_class', ''):
executor_number = executor['number']
build_number = executable['number']
url = executable['url']
m = re.search(r'/job/([^/]+)/.*', urlparse(url).path)
job_name = m.group(1)
builds.append({'name': job_name,
'number': build_number,
'url': url,
'node': node_name,
'executor': executor_number})
return builds
>>> info_master = server.get_node_info('(master)', depth=2)
As seen below, the currentExecutable key in the second executor
(number: 1) is not an array, but rather a string "None", causing the
build.append to fail and return an error.
>>> info_master['executors']
[{u'likelyStuck': False, u'number': 0, u'idle': False, u'currentWorkUnit': {}, u'progress': 92, u'currentExecutable': {u'_class': u'org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$PlaceholderExecutable'}}, {u'likelyStuck': False, u'number': 1, u'idle': True, u'currentWorkUnit': None, u'progress': -1, u'currentExecutable': None}
ERROR:
>>> server.get_running_builds
<bound method Jenkins.get_running_builds of <jenkins.Jenkins object at 0x7f5965989c90>>
>>> server.get_running_builds90
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Jenkins' object has no attribute 'get_running_builds90'
>>> server.get_running_builds()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/jenkins/__init__.py", line 1151, in get_running_builds
build_number = executable['number']
KeyError: 'number'
>>>
To manage notifications about this bug go to:
https://bugs.launchpad.net/python-jenkins/+bug/1682629/+subscriptions