summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--awx/main/models/workflow.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/awx/main/models/workflow.py b/awx/main/models/workflow.py
index 0753ae4992..2b23b0adbc 100644
--- a/awx/main/models/workflow.py
+++ b/awx/main/models/workflow.py
@@ -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)