set workflow status to failed if we find a node w/ a missing UJT

see: https://github.com/ansible/tower/issues/2576
This commit is contained in:
Ryan Petrello 2018-07-30 16:11:44 -04:00
parent 55d1f5c11c
commit 184db58fa3
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777
2 changed files with 10 additions and 0 deletions

View File

@ -69,6 +69,7 @@ class WorkflowDAG(SimpleDAG):
job = obj.job
if obj.unified_job_template is None:
is_failed = True
continue
elif not job:
return False, False

View File

@ -61,6 +61,15 @@ class TestWorkflowDAGFunctional(TransactionTestCase):
self.assertTrue(is_done)
self.assertFalse(has_failed)
# verify that relaunched WFJ fails if a JT leaf is deleted
for jt in JobTemplate.objects.all():
jt.delete()
relaunched = wfj.create_relaunch_workflow_job()
dag = WorkflowDAG(workflow_job=relaunched)
is_done, has_failed = dag.is_workflow_done()
self.assertTrue(is_done)
self.assertTrue(has_failed)
def test_workflow_fails_for_unfinished_node(self):
wfj = self.workflow_job(states=['error', None, None, None, None])
dag = WorkflowDAG(workflow_job=wfj)