Putting back the inadvertantly removed job_events

This commit is contained in:
Matthew Jones 2017-01-26 12:00:13 -05:00
parent 37d8e57c4f
commit 6388e9b055
2 changed files with 17 additions and 0 deletions

View File

@ -204,6 +204,7 @@ job_urls = patterns('awx.api.views',
url(r'^(?P<pk>[0-9]+)/cancel/$', 'job_cancel'),
url(r'^(?P<pk>[0-9]+)/relaunch/$', 'job_relaunch'),
url(r'^(?P<pk>[0-9]+)/job_host_summaries/$', 'job_job_host_summaries_list'),
url(r'^(?P<pk>[0-9]+)/job_events/$', 'job_job_events_list'),
url(r'^(?P<pk>[0-9]+)/activity_stream/$', 'job_activity_stream_list'),
url(r'^(?P<pk>[0-9]+)/stdout/$', 'job_stdout'),
url(r'^(?P<pk>[0-9]+)/notifications/$', 'job_notifications_list'),

View File

@ -3473,6 +3473,22 @@ class GroupJobEventsList(BaseJobEventsList):
parent_model = Group
class JobJobEventsList(BaseJobEventsList):
parent_model = Job
def get_queryset(self):
job = self.get_parent_object()
self.check_parent_access(job)
qs = job.job_events.all()
qs = qs.select_related('host')
qs = qs.prefetch_related('hosts', 'children')
if self.request.user.is_superuser or self.request.user.is_system_auditor:
return qs.all()
host_qs = self.request.user.get_queryset(Host)
return qs.filter(Q(host__isnull=True) | Q(host__in=host_qs))
class AdHocCommandList(ListCreateAPIView):
model = AdHocCommand