mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 11:27:36 -02:30
Mutex validator added.
This commit is contained in:
@@ -2657,6 +2657,11 @@ class WorkflowJobTemplateNodeChildrenBaseList(EnforceParentRelationshipMixin, Su
|
||||
return getattr(parent, self.relationship).all()
|
||||
|
||||
def is_valid_relation(self, parent, sub, created=False):
|
||||
mutex_list = ('success_nodes', 'failure_nodes') if self.relationship == 'always_nodes' else ('always_nodes',)
|
||||
for relation in mutex_list:
|
||||
if getattr(parent, relation).all().exists():
|
||||
return {'Error': 'Cannot associate {0} when {1} have been associated.'.format(self.relationship, relation)}
|
||||
|
||||
if created:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user