1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

Merge pull request #343 from jangsutsr/7530_add_pending_deletion_check_to_job_relaunch_validation

Add pending_deletion check to job relaunch validation
This commit is contained in:
Aaron Tan 2017-08-25 16:50:16 -04:00 committed by GitHub
commit 853b9d1001

View File

@ -2630,7 +2630,7 @@ class JobRelaunchSerializer(JobSerializer):
raise serializers.ValidationError(dict(credential=[_("Credential not found or deleted.")])) raise serializers.ValidationError(dict(credential=[_("Credential not found or deleted.")]))
if obj.project is None: if obj.project is None:
raise serializers.ValidationError(dict(errors=[_("Job Template Project is missing or undefined.")])) raise serializers.ValidationError(dict(errors=[_("Job Template Project is missing or undefined.")]))
if obj.inventory is None: if obj.inventory is None or obj.inventory.pending_deletion:
raise serializers.ValidationError(dict(errors=[_("Job Template Inventory is missing or undefined.")])) raise serializers.ValidationError(dict(errors=[_("Job Template Inventory is missing or undefined.")]))
attrs = super(JobRelaunchSerializer, self).validate(attrs) attrs = super(JobRelaunchSerializer, self).validate(attrs)
return attrs return attrs