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

Merge pull request #6116 from AlanCoding/early_error

Fail on launch for scenario where job cannot run

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-03-04 15:19:22 +00:00 committed by GitHub
commit 73b33e1435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4054,6 +4054,13 @@ class JobLaunchSerializer(BaseSerializer):
**attrs)
self._ignored_fields = rejected
# Basic validation - cannot run a playbook without a playbook
if not template.project:
errors['project'] = _("A project is required to run a job.")
elif template.project.status in ('error', 'failed'):
errors['playbook'] = _("Missing a revision to run due to failed project update.")
# cannot run a playbook without an inventory
if template.inventory and template.inventory.pending_deletion is True:
errors['inventory'] = _("The inventory associated with this Job Template is being deleted.")
elif 'inventory' in accepted and accepted['inventory'].pending_deletion: