mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 02:31:03 -03:30
Merge pull request #1159 from AlanCoding/reschedule_msg
Verbose error messages for failure to re-schedule
This commit is contained in:
@@ -16,7 +16,7 @@ import six
|
|||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import FieldError
|
from django.core.exceptions import FieldError, ObjectDoesNotExist
|
||||||
from django.db.models import Q, Count, F
|
from django.db.models import Q, Count, F
|
||||||
from django.db import IntegrityError, transaction
|
from django.db import IntegrityError, transaction
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
@@ -4204,7 +4204,15 @@ class JobCreateSchedule(RetrieveAPIView):
|
|||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
|
|
||||||
if not obj.can_schedule:
|
if not obj.can_schedule:
|
||||||
return Response({"error": _('Information needed to schedule this job is missing.')},
|
if getattr(obj, 'passwords_needed_to_start', None):
|
||||||
|
return Response({"error": _('Cannot create schedule because job requires credential passwords.')},
|
||||||
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
try:
|
||||||
|
obj.launch_config
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
return Response({"error": _('Cannot create schedule because job was launched by legacy method.')},
|
||||||
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
return Response({"error": _('Cannot create schedule because a related resource is missing.')},
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
config = obj.launch_config
|
config = obj.launch_config
|
||||||
|
|||||||
Reference in New Issue
Block a user