[kteam-tools][PATCH] ktl: fix new-package crash: no attribute 'stakeholder'
Kamal Mostafa
kamal at canonical.com
Tue Nov 13 18:26:09 UTC 2018
Fix crashes when using create-release-tracker --new-package.
Be more careful to not dereference possible NoneType returns from LP API
(as for brand new packages) when looking for the 'stakeholder' attribute.
File "/home/kamal/src/ckt/kteam-tools/stable/ktl/workflow.py", in assignee_ex
cursor = cursor.lookup_source(packagename)
retval = cursor.stakeholder
AttributeError: 'NoneType' object has no attribute 'stakeholder'
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
ktl/tracking_bug.py | 2 +-
ktl/workflow.py | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/ktl/tracking_bug.py b/ktl/tracking_bug.py
index efea367..bd26f79 100644
--- a/ktl/tracking_bug.py
+++ b/ktl/tracking_bug.py
@@ -109,7 +109,7 @@ class TrackingBug:
if lp_series.name == 'stakeholder-signoff':
cursor = self.kernel_series.lookup_series(codename=targeted_series_name)
cursor = cursor.lookup_source(package)
- if cursor.stakeholder is None:
+ if cursor and cursor.stakeholder is None:
cdebug(' no stakeholder-signoff', 'yellow')
break
if lp_series.name == 'promote-to-release' and not self.isdev:
diff --git a/ktl/workflow.py b/ktl/workflow.py
index b71e02f..76f83b0 100644
--- a/ktl/workflow.py
+++ b/ktl/workflow.py
@@ -231,8 +231,9 @@ class Workflow:
ks = KernelSeries()
cursor = ks.lookup_series(codename=series_codename)
cursor = cursor.lookup_source(packagename)
- retval = cursor.stakeholder
- else:
+ if cursor:
+ retval = cursor.stakeholder
+ if not retval:
retval = self.assignee(packagename, taskname, devel)
return retval
--
2.7.4
More information about the kernel-team
mailing list