remove relationship in view if cycle detected

This commit is contained in:
chris meyers 2018-11-01 12:45:17 -04:00 committed by mabashian
parent 9afc38b714
commit 2f9dc4d075

View File

@ -2959,12 +2959,12 @@ class WorkflowJobTemplateNodeChildrenBaseList(WorkflowsEnforcementMixin, Enforce
parent_node_type_relationship = getattr(parent, self.relationship)
parent_node_type_relationship.add(sub)
parent.save()
graph = WorkflowDAG(parent.workflow_job_template)
if graph.has_cycle():
parent_node_type_relationship.remove(sub)
return {"Error": _("Cycle detected.")}
parent_node_type_relationship.remove(sub)
return None