Skip to content

Commit 14599e0

Browse files
fostersethdjyasin
authored andcommitted
awx modules wait on event processing finished (ansible#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.
1 parent b3a72a6 commit 14599e0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

awx_collection/plugins/module_utils/controller_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,10 @@ def wait_on_url(self, url, object_name, object_type, timeout=30, interval=2):
10381038
# Grab our start time to compare against for the timeout
10391039
start = time.time()
10401040
result = self.get_endpoint(url)
1041-
while not result['json']['finished']:
1041+
wait_on_field = 'event_processing_finished'
1042+
if wait_on_field not in result['json']:
1043+
wait_on_field = 'finished'
1044+
while not result['json'][wait_on_field]:
10421045
# If we are past our time out fail with a message
10431046
if timeout and timeout < time.time() - start:
10441047
# Account for Legacy messages

0 commit comments

Comments
 (0)