diff mbox

[kteam-tools] start-sru-cycle: Handle failing bug creation more gracefully

Message ID 1493216515-10014-1-git-send-email-stefan.bader@canonical.com
State New
Headers show

Commit Message

Stefan Bader April 26, 2017, 2:21 p.m. UTC
A quick fix which maybe could be more elegant and the actual error message
is up for bike shedding.

-Stefan

From f56479f1f5c47501d5b311724125d1192e798bfa Mon Sep 17 00:00:00 2001
From: Stefan Bader <stefan.bader@canonical.com>
Date: Wed, 26 Apr 2017 16:15:23 +0200
Subject: [PATCH] start-sru-cycle: Handle failing bug creation more gracefully

Calling tb.open() can return None when it completely fails to create
the new bug report. One major reason for this seems to be that the
package does not exist on the ubuntu project.
Instead of failing completely, print an error message and go on with
the other backports or derivatives.
Still fail completely if the master bug cannot be created because that
really is ultimately bad.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 stable/start-sru-cycle | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Thadeu Lima de Souza Cascardo April 26, 2017, 3:20 p.m. UTC | #1
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Kamal Mostafa April 26, 2017, 4:12 p.m. UTC | #2

Stefan Bader April 27, 2017, 9:26 a.m. UTC | #3

diff mbox

Patch

diff --git a/stable/start-sru-cycle b/stable/start-sru-cycle
index daab835..6e7528c 100755
--- a/stable/start-sru-cycle
+++ b/stable/start-sru-cycle
@@ -105,6 +105,9 @@  class Crankers():
                     for backport_project, backport_series in data[series][master_project]['backports']:
                         print('        %s:%s' % (backport_series, backport_project))
                         bug = tb.open(backport_project, '<version to be filled>', True, master_bug.id, backport_series)
+                        if bug == None:
+                            print('     -> EE: Bug creation failed (does the package exist in the archive?)!')
+                            continue
                         bug.tags.append(cycle_tag)
                         backports.append(str(bug.id))
                         bug.tags.append('kernel-sru-backport-of-%s' % master_bug.id)
@@ -113,6 +116,9 @@  class Crankers():
                     for derivative_project in data[series][master_project]['derivatives']:
                         print('        ' + derivative_project)
                         bug = tb.open(derivative_project, '<version to be filled>', True, master_bug.id, series)
+                        if bug == None:
+                            print('     -> EE: Bug creation failed (does the package exist in the archive?)!')
+                            continue
                         bug.tags.append(cycle_tag)
                         derivatives.append(str(bug.id))
                         bug.tags.append('kernel-sru-derivative-of-%s' % master_bug.id)