mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
safeguard against infinite loop if jobs have cycles
This commit is contained in:
parent
01d1470544
commit
5169fe3484
@ -516,8 +516,14 @@ class WorkflowJob(UnifiedJob, WorkflowJobOptions, SurveyJobMixin, JobNotificatio
|
||||
def get_ancestor_workflows(self):
|
||||
ancestors = []
|
||||
wj = self
|
||||
wj_ids = set([])
|
||||
while True:
|
||||
wj_ids.add(wj.id)
|
||||
wj = wj.get_workflow_job()
|
||||
if wj.id in wj_ids:
|
||||
logger.critical('Cycles detected in the workflow jobs graph, '
|
||||
'this is not normal and suggests task manager degeneracy.')
|
||||
break
|
||||
if (not wj) or (not wj.workflow_job_template_id):
|
||||
break
|
||||
ancestors.append(wj.workflow_job_template_id)
|
||||
|
Loading…
Reference in New Issue
Block a user