mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 05:29:26 -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,9 +670,11 @@ 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' not in update_fields:
|
if host_id.exists():
|
||||||
update_fields.append('host_id')
|
self.host_id = host_id[0]
|
||||||
|
if 'host_id' not in update_fields:
|
||||||
|
update_fields.append('host_id')
|
||||||
except (IndexError, AttributeError):
|
except (IndexError, AttributeError):
|
||||||
pass
|
pass
|
||||||
if self.parent is None:
|
if self.parent is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user