1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

block system JT from being used in workflows

This commit is contained in:
AlanCoding 2016-09-28 15:14:27 -04:00
parent 78fc6df59d
commit 37270bfb13

View File

@ -2303,8 +2303,9 @@ class WorkflowJobTemplateNodeSerializer(WorkflowNodeBaseSerializer):
"job_type": "%s is not a valid job type. The choices are %s." % (
attrs['char_prompts']['job_type'], job_types)})
ujt_obj = attrs.get('unified_job_template', None)
if isinstance(ujt_obj, WorkflowJobTemplate):
raise serializers.ValidationError({"unified_job_template": "Can not nest Workflow Job Templates inside of Workflow Job Templates"})
if isinstance(ujt_obj, (WorkflowJobTemplate, SystemJobTemplate)):
raise serializers.ValidationError({
"unified_job_template": "Can not nest a %s inside a WorkflowJobTemplate" % ujt_obj.__class__.__name__})
return super(WorkflowJobTemplateNodeSerializer, self).validate(attrs)
class WorkflowJobNodeSerializer(WorkflowNodeBaseSerializer):