Merge lp:~rmescandon/jenkins-launchpad-plugin/prevent-exception-when-no-downstream-project into lp:jenkins-launchpad-plugin

Proposed by Roberto Mier Escandon
Status: Work in progress
Proposed branch: lp:~rmescandon/jenkins-launchpad-plugin/prevent-exception-when-no-downstream-project
Merge into: lp:jenkins-launchpad-plugin
Diff against target: 15 lines (+5/-2)
1 file modified
jlp/jenkinsutils.py (+5/-2)
To merge this branch: bzr merge lp:~rmescandon/jenkins-launchpad-plugin/prevent-exception-when-no-downstream-project
Reviewer Review Type Date Requested Status
Joshua Powers (community) Needs Fixing
Review via email: mp+333630@code.launchpad.net

Description of the change

I've hit exceptions when using launchpadTrigger with a job that hasn't downstream projects

To post a comment you must log in.
Revision history for this message
Joshua Powers (powersj) wrote :

Looks like you and I both have run into this:

https://code.launchpad.net/~powersj/jenkins-launchpad-plugin/add-jenkins-pipeline-support/+merge/326245

You can either comment on mine or what we can do is if you fix your bare except (e.g. except -> except KeyError) and add a log message and then I can accept yours.

review: Needs Fixing

Unmerged revisions

133. By Roberto Mier Escandon

prevent exception when not set downstreamProjects job data

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'jlp/jenkinsutils.py'
2--- jlp/jenkinsutils.py 2016-08-13 01:08:59 +0000
3+++ jlp/jenkinsutils.py 2017-11-13 16:47:58 +0000
4@@ -571,8 +571,11 @@
5 def get_downstream_projects(jenkins, job_url):
6 data = jenkins.get_json_data(job_url + '/')
7 downstream_projects = []
8- for project in data['downstreamProjects']:
9- downstream_projects.append(project['name'])
10+ try:
11+ for project in data['downstreamProjects']:
12+ downstream_projects.append(project['name'])
13+ except:
14+ pass
15 return downstream_projects
16
17

Subscribers

People subscribed via source and target branches