mirror of
https://github.com/ansible/awx.git
synced 2026-03-24 20:35:02 -02:30
Compare commits
4 Commits
devel
...
AAP-57614-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a205af41f | ||
|
|
96bd35bfb4 | ||
|
|
21e73cb065 | ||
|
|
53be3d16bd |
@@ -277,7 +277,6 @@ class RunnerCallback:
|
|||||||
def artifacts_handler(self, artifact_dir):
|
def artifacts_handler(self, artifact_dir):
|
||||||
success, query_file_contents = try_load_query_file(artifact_dir)
|
success, query_file_contents = try_load_query_file(artifact_dir)
|
||||||
if success:
|
if success:
|
||||||
self.delay_update(event_queries_processed=False)
|
|
||||||
collections_info = collect_queries(query_file_contents)
|
collections_info = collect_queries(query_file_contents)
|
||||||
for collection, data in collections_info.items():
|
for collection, data in collections_info.items():
|
||||||
version = data['version']
|
version = data['version']
|
||||||
@@ -301,6 +300,24 @@ class RunnerCallback:
|
|||||||
else:
|
else:
|
||||||
logger.warning(f'The file {COLLECTION_FILENAME} unexpectedly did not contain ansible_version')
|
logger.warning(f'The file {COLLECTION_FILENAME} unexpectedly did not contain ansible_version')
|
||||||
|
|
||||||
|
# Write event_queries_processed and installed_collections directly
|
||||||
|
# to the DB instead of using delay_update. delay_update defers
|
||||||
|
# writes until the final job status save, but
|
||||||
|
# events_processed_hook (called from both the task runner after
|
||||||
|
# the final save and the callback receiver after the wrapup
|
||||||
|
# event) needs event_queries_processed=False visible in the DB
|
||||||
|
# to dispatch save_indirect_host_entries. The field defaults to
|
||||||
|
# True, so without a direct write the hook would see True and
|
||||||
|
# skip the dispatch. installed_collections is also written
|
||||||
|
# directly so it is available if the callback receiver
|
||||||
|
# dispatches before the final save.
|
||||||
|
from awx.main.models import Job
|
||||||
|
|
||||||
|
db_updates = {'event_queries_processed': False}
|
||||||
|
if 'installed_collections' in query_file_contents:
|
||||||
|
db_updates['installed_collections'] = query_file_contents['installed_collections']
|
||||||
|
Job.objects.filter(id=self.instance.id).update(**db_updates)
|
||||||
|
|
||||||
self.artifacts_processed = True
|
self.artifacts_processed = True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user