link-to-tracker: fail if tracker bug is not found

Submitted by Thadeu Lima de Souza Cascardo on April 4, 2017, 3:49 p.m.

Details

Message ID 20170404154904.17498-1-cascardo@canonical.com
State New
Headers show

Commit Message

Thadeu Lima de Souza Cascardo April 4, 2017, 3:49 p.m.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 stable/link-to-tracker | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Brad Figg April 4, 2017, 4:14 p.m.

Stefan Bader April 4, 2017, 4:17 p.m.

Patch hide | download patch | download mbox

diff --git a/stable/link-to-tracker b/stable/link-to-tracker
index b9a3f05..d3d84a4 100755
--- a/stable/link-to-tracker
+++ b/stable/link-to-tracker
@@ -151,11 +151,16 @@  class Tracking():
         retval = 1
         try:
             target_package, target_series = s.repo_info
+            found = False
             for bugid in s.trackers(s.project_tracked):
                 tasks_by_name = s.create_tasks_by_name_mapping(bugid, s.project_tracked)
                 if '%s (Ubuntu %s)' % (target_package, target_series.title()) in tasks_by_name:
+                    found = True
                     break
 
+            if found == False:
+                raise AppError('Cannot find tracker bug matching package %s series %s' % (target_package,target_series))
+                exit(retval)
             # -------------------------------------------------------------------------------------
             # C H A N G E L O G   W O R K