mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 18:51:06 -03:30
Fail on launch for scenario where job cannot run
This commit is contained in:
@@ -4054,6 +4054,13 @@ class JobLaunchSerializer(BaseSerializer):
|
|||||||
**attrs)
|
**attrs)
|
||||||
self._ignored_fields = rejected
|
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:
|
if template.inventory and template.inventory.pending_deletion is True:
|
||||||
errors['inventory'] = _("The inventory associated with this Job Template is being deleted.")
|
errors['inventory'] = _("The inventory associated with this Job Template is being deleted.")
|
||||||
elif 'inventory' in accepted and accepted['inventory'].pending_deletion:
|
elif 'inventory' in accepted and accepted['inventory'].pending_deletion:
|
||||||
|
|||||||
Reference in New Issue
Block a user