1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-05 05:51:21 +03:00

Work on AC-205. Update display of extra events triggered by async polling.

This commit is contained in:
Chris Church 2013-08-05 00:55:59 -04:00
parent a4af00da85
commit f787ff8251
2 changed files with 22 additions and 2 deletions

View File

@ -898,8 +898,10 @@ class JobEventAccess(BaseAccess):
return qs
job_qs = self.user.get_queryset(Job)
host_qs = self.user.get_queryset(Host)
return qs.filter(Q(host__isnull=True) | Q(host__in=host_qs),
job__in=job_qs)
qs = qs.filter(Q(host__isnull=True) | Q(host__in=host_qs),
job__in=job_qs)
# FIXME: Filter certain extra events from async polling?
return qs
def can_add(self, data):
return False

View File

@ -1139,6 +1139,24 @@ class JobEvent(models.Model):
elif self.event == 'playbook_on_task_start':
if self.task is not None:
msg = "%s (%s)" % (msg, self.task)
# Change display for runner events trigged by async polling.
if self.event in ('runner_on_ok', 'runner_on_failed'):
res = self.event_data.get('res', {})
try:
module_name = res['invocation']['module_name']
job_id = res['ansible_job_id']
except (TypeError, KeyError, AttributeError):
module_name = None
job_id = None
if module_name and job_id:
if module_name == 'async_status':
msg = 'Host Async Checking'
else:
msg = 'Host Async Started'
#msg = '%s %s %s' % (msg, module_name, job_id)
#msg = '%s [%s]' % (msg, self.event)
return msg
def _find_parent(self):