diff --git a/awx/main/access.py b/awx/main/access.py index 4bc35a3254..a42e99c108 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -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 diff --git a/awx/main/models/__init__.py b/awx/main/models/__init__.py index 69ce87e35b..7b26ab4e0d 100644 --- a/awx/main/models/__init__.py +++ b/awx/main/models/__init__.py @@ -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):