mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 10:57:35 -02:30
Fix a minor typo in job events model and restructure a bit to fix 500 error.
This commit is contained in:
@@ -2966,7 +2966,11 @@ class JobJobTasksList(BaseJobEventsList):
|
|||||||
return ({'detail': 'Parent event not found.'}, -1, status.HTTP_404_NOT_FOUND)
|
return ({'detail': 'Parent event not found.'}, -1, status.HTTP_404_NOT_FOUND)
|
||||||
parent_task = parent_task[0]
|
parent_task = parent_task[0]
|
||||||
|
|
||||||
queryset = JobEvent.start_event_queryset(parent_task)
|
# Some events correspond to a playbook or task starting up,
|
||||||
|
# and these are what we're interested in here.
|
||||||
|
STARTING_EVENTS = ('playbook_on_task_start', 'playbook_on_setup')
|
||||||
|
|
||||||
|
queryset = JobEvent.start_event_queryset(parent_task, STARTING_EVENTS)
|
||||||
|
|
||||||
# The data above will come back in a list, but we are going to
|
# The data above will come back in a list, but we are going to
|
||||||
# want to access it based on the parent id, so map it into a
|
# want to access it based on the parent id, so map it into a
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from urlparse import urljoin
|
|||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q, Count
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
@@ -1206,12 +1206,9 @@ class JobEvent(CreatedModifiedModel):
|
|||||||
job.inventory.update_computed_fields()
|
job.inventory.update_computed_fields()
|
||||||
emit_websocket_notification('/socket.io/jobs', 'summary_complete', dict(unified_job_id=job.id))
|
emit_websocket_notification('/socket.io/jobs', 'summary_complete', dict(unified_job_id=job.id))
|
||||||
|
|
||||||
@property
|
|
||||||
def STARTING_EVENTS():
|
|
||||||
return ('playbook_on_task_start', 'playbook_on_setup')
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_startevent_queryset(cls, parent_task, ordering=None):
|
def start_event_queryset(cls, parent_task, starting_events, ordering=None):
|
||||||
'''
|
'''
|
||||||
We need to pull information about each start event.
|
We need to pull information about each start event.
|
||||||
|
|
||||||
@@ -1221,7 +1218,7 @@ class JobEvent(CreatedModifiedModel):
|
|||||||
need stats on grandchildren, sorted by child.
|
need stats on grandchildren, sorted by child.
|
||||||
'''
|
'''
|
||||||
qs = (JobEvent.objects.filter(parent__parent=parent_task,
|
qs = (JobEvent.objects.filter(parent__parent=parent_task,
|
||||||
parent__event__in=STARTING_EVENTS)
|
parent__event__in=starting_events)
|
||||||
.values('parent__id', 'event', 'changed')
|
.values('parent__id', 'event', 'changed')
|
||||||
.annotate(num=Count('event'))
|
.annotate(num=Count('event'))
|
||||||
.order_by('parent__id'))
|
.order_by('parent__id'))
|
||||||
|
|||||||
Reference in New Issue
Block a user