[kteam-tools 1/1] [link-to-tracker] Add a sanity check before modifying a TB

Juerg Haefliger juerg.haefliger at canonical.com
Thu Jun 29 07:57:45 UTC 2017


The to-be-modified TB should have '<version to be filled>' in its title.
Bail out if that's not the case to prevent accidents (which happened to
me twice already).

Signed-off-by: Juerg Haefliger <juerg.haefliger at canonical.com>
---
 stable/link-to-tracker | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/stable/link-to-tracker b/stable/link-to-tracker
index 356c017c5017..a4df8dfa0cd3 100755
--- a/stable/link-to-tracker
+++ b/stable/link-to-tracker
@@ -165,6 +165,11 @@ class Tracking(object):
             if not found:
                 raise AppError('Cannot find tracker bug matching package %s series %s' % (target_package, target_series))
 
+            # Sanity check: Bail out if the version is already filled
+            lpbug = self.launchpad.bugs[bugid]
+            if 'version to be filled' not in lpbug.title:
+                raise AppError('Version is already filled for LP #%s (%s)' % (bugid, lpbug.title))
+
             # -------------------------------------------------------------------------------------
             # C H A N G E L O G   W O R K
 
@@ -185,10 +190,11 @@ class Tracking(object):
                     f.write(line)
             retval = 0
 
-            lpbug = self.launchpad.bugs[bugid]
+            # Update the title of the tracking bug
             lpbug.title = title
             lpbug.lp_save()
 
+            # Update the state and assignee of the 'prepare-package' task
             task = tasks_by_name['prepare-package'].lp_task
             task.status = "In Progress"
             task.assignee = self.launchpad.me
-- 
2.11.0





More information about the kernel-team mailing list