summaryrefslogtreecommitdiffstats
path: root/awx_collection
diff options
context:
space:
mode:
authorSeth Foster <fosterseth@users.noreply.github.com>2024-04-26 23:33:34 +0200
committerGitHub <noreply@github.com>2024-04-26 23:33:34 +0200
commit4754819a0916cbd9352550fb0f8fbc65273854b0 (patch)
tree08285f75cd09c6ee5e36417b65ba2234112a76f9 /awx_collection
parentPin openssl 3.0.7 (#15147) (diff)
downloadawx-4754819a0916cbd9352550fb0f8fbc65273854b0.tar.xz
awx-4754819a0916cbd9352550fb0f8fbc65273854b0.zip
awx modules wait on event processing finished (#15152)
This change makes "wait: true" for jobs and syncs look at the event_processing_finished instead of finished field. Right now there is a race condition where a module might try to delete an inventory, but the events for an inventory sync have not yet finished. We have a RelatedJobsPreventDeleteMixin that checks for this condition. bulk jobs don't have event_processing_finished so we just use finished field in that case.
Diffstat (limited to 'awx_collection')
-rw-r--r--awx_collection/plugins/module_utils/controller_api.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/awx_collection/plugins/module_utils/controller_api.py b/awx_collection/plugins/module_utils/controller_api.py
index 37c784e0a2..0f48fc2dff 100644
--- a/awx_collection/plugins/module_utils/controller_api.py
+++ b/awx_collection/plugins/module_utils/controller_api.py
@@ -1038,7 +1038,10 @@ class ControllerAPIModule(ControllerModule):
# Grab our start time to compare against for the timeout
start = time.time()
result = self.get_endpoint(url)
- while not result['json']['finished']:
+ wait_on_field = 'event_processing_finished'
+ if wait_on_field not in result['json']:
+ wait_on_field = 'finished'
+ while not result['json'][wait_on_field]:
# If we are past our time out fail with a message
if timeout and timeout < time.time() - start:
# Account for Legacy messages