mirror of
https://github.com/ansible/awx.git
synced 2026-05-13 04:17:36 -02:30
Fix an issue where we weren't creating job events for hosts that didn't
exist in our inventory
This commit is contained in:
@@ -670,7 +670,9 @@ class JobEvent(CreatedModifiedModel):
|
|||||||
try:
|
try:
|
||||||
if not self.host_id and self.host_name:
|
if not self.host_id and self.host_name:
|
||||||
host_qs = Host.objects.filter(inventory__jobs__id=self.job_id, name=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]
|
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:
|
if 'host_id' not in update_fields:
|
||||||
update_fields.append('host_id')
|
update_fields.append('host_id')
|
||||||
except (IndexError, AttributeError):
|
except (IndexError, AttributeError):
|
||||||
|
|||||||
Reference in New Issue
Block a user