mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 19:35:02 -02:30
AAP-57614 fix: dispatch save_indirect_host_entries from artifacts_handler
The artifacts_handler and handle_success_and_failure_notifications can run in either order after job completion. Since event_queries_processed defaults to True on the Job model, when the notification handler runs first it sees True (the default) and skips dispatching save_indirect_host_entries. When artifacts_handler runs later and sets event_queries_processed to False, no task is dispatched to process the EventQuery records, leaving event_queries_processed stuck at False and no IndirectManagedNodeAudit records created. Fix by also dispatching save_indirect_host_entries from artifacts_handler after EventQuery records are created. The task's select_for_update lock prevents duplicate processing if both code paths dispatch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ from collections import deque
|
||||
from typing import Tuple, Optional
|
||||
|
||||
from awx.main.models.event_query import EventQuery
|
||||
from awx.main.tasks.host_indirect import save_indirect_host_entries
|
||||
|
||||
# Django
|
||||
from django.conf import settings
|
||||
@@ -301,6 +302,14 @@ class RunnerCallback:
|
||||
else:
|
||||
logger.warning(f'The file {COLLECTION_FILENAME} unexpectedly did not contain ansible_version')
|
||||
|
||||
# Dispatch save_indirect_host_entries to process the EventQuery
|
||||
# records created above. handle_success_and_failure_notifications
|
||||
# may have already run and skipped dispatching because
|
||||
# event_queries_processed defaults to True and artifacts_handler
|
||||
# can run after the notification handler. The task's
|
||||
# select_for_update lock prevents duplicate processing.
|
||||
save_indirect_host_entries.delay(self.instance.id)
|
||||
|
||||
self.artifacts_processed = True
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user