← Back to team overview

python-jenkins-developers team mailing list archive

[Bug 1659787] [NEW] `get_running_builds` raises an error when there are placeholder tasks

 

Public bug reported:

The `get_running_builds` method on the `Jenkins` class will raise an
exception when it tries to return a list of running builds which
contains placeholder tasks.

This line tries to access a build number, which isn't yet available:
https://github.com/openstack/python-jenkins/blob/0f6739103b8b02e3c55ad8d8f4bbb5265273d669/jenkins/__init__.py#L1151

```
>>> j = Jenkins('https://jenkins.example.com', username='jenkins_user', password='password1')
>>> j.get_running_builds()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/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/1659787

Title:
  `get_running_builds` raises an error when there are placeholder tasks

Status in Python Jenkins:
  New

Bug description:
  The `get_running_builds` method on the `Jenkins` class will raise an
  exception when it tries to return a list of running builds which
  contains placeholder tasks.

  This line tries to access a build number, which isn't yet available:
  https://github.com/openstack/python-jenkins/blob/0f6739103b8b02e3c55ad8d8f4bbb5265273d669/jenkins/__init__.py#L1151

  ```
  >>> j = Jenkins('https://jenkins.example.com', username='jenkins_user', password='password1')
  >>> j.get_running_builds()
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/local/lib/python3.6/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/1659787/+subscriptions


Follow ups