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

Fix an issue where we weren't creating job events for hosts that didn't

exist in our inventory
This commit is contained in:
Matthew Jones 2014-06-27 13:47:20 -04:00
parent f1b017f0a4
commit 1e00529fac

View File

@ -670,9 +670,11 @@ class JobEvent(CreatedModifiedModel):
try:
if not self.host_id and self.host_name:
host_qs = Host.objects.filter(inventory__jobs__id=self.job_id, name=self.host_name)
self.host_id = host_qs.only('id').values_list('id', flat=True)[0]
if 'host_id' not in update_fields:
update_fields.append('host_id')
host_id = host_qs.only('id').values_list('id', flat=True)
if host_id.exists():
self.host_id = host_id[0]
if 'host_id' not in update_fields:
update_fields.append('host_id')
except (IndexError, AttributeError):
pass
if self.parent is None: