swm: promote_to_updates.py: check for snap tasks before closing tb

Message ID 20171218113414.11756-1-kleber.souza@canonical.com
State New
Headers show
Series
  • swm: promote_to_updates.py: check for snap tasks before closing tb
Related show

Commit Message

Kleber Souza Dec. 18, 2017, 11:34 a.m.
Do not close the tracking bug until all the snap-related tasks are
either Invalid or Fix Released.

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
---
 stable/wfl/wft/promote_to_updates.py | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch

diff --git a/stable/wfl/wft/promote_to_updates.py b/stable/wfl/wft/promote_to_updates.py
index d0377cf4..29f6c393 100644
--- a/stable/wfl/wft/promote_to_updates.py
+++ b/stable/wfl/wft/promote_to_updates.py
@@ -141,6 +141,15 @@  class PromoteToUpdates(Promoter):
                     cinfo('            package promote-to-security status (%s) does not match security-signoff status (%s)' % (promote_to_security.status, security_signoff.status), 'yellow')
                     break
 
+                # Check that all snap tasks are either "Invalid" or "Fix Released"
+                snap_done = True
+                for taskname in s.bug.tasks_by_name:
+                    if taskname.startswith('snap-') and s.bug.tasks_by_name[taskname].status not in ['Invalid', 'Fix Released']:
+                        cinfo('            %s is neither "Fix Released" nor "Invalid" (%s)' % (taskname, s.bug.tasks_by_name[taskname].status), 'yellow')
+                        snap_done = False
+                if not snap_done:
+                    break
+
             # All is completed so we can finally close out this workflow bug.
             s.bug.tasks_by_name[s.bug.workflow_project].status = 'Fix Released'
             if promote_to_updates.status == 'Invalid':