mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-16 21:11:49 -05:00
enforce 1 edge between 2 nodes constraint
This commit is contained in:
@@ -2957,6 +2957,12 @@ class WorkflowJobTemplateNodeChildrenBaseList(WorkflowsEnforcementMixin, Enforce
|
||||
if parent.id == sub.id:
|
||||
return {"Error": _("Cycle detected.")}
|
||||
|
||||
if WorkflowJobTemplateNode.objects.filter(Q(pk=parent.id) &
|
||||
Q(success_nodes__in=[sub.id]) |
|
||||
Q(failure_nodes__in=[sub.id]) |
|
||||
Q(always_nodes__in=[sub.id])).exists():
|
||||
return {"Error": _("Relationship not allowed.")}
|
||||
|
||||
parent_node_type_relationship = getattr(parent, self.relationship)
|
||||
parent_node_type_relationship.add(sub)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user