parent
3f41c76564
commit
c04a751f0e
2 changed files with 15 additions and 9 deletions
5
changelogs/fragments/70023-results-type-filtering.yml
Normal file
5
changelogs/fragments/70023-results-type-filtering.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
bugfixes:
|
||||||
|
- Strategy - Ensure we only process expected types from the results queue
|
||||||
|
and produce warnings for any object we receive from the queue that doesn't
|
||||||
|
match our expectations.
|
||||||
|
(https://github.com/ansible/ansible/issues/70023)
|
|
@ -100,16 +100,17 @@ def results_thread_main(strategy):
|
||||||
result = strategy._final_q.get()
|
result = strategy._final_q.get()
|
||||||
if isinstance(result, StrategySentinel):
|
if isinstance(result, StrategySentinel):
|
||||||
break
|
break
|
||||||
|
elif isinstance(result, TaskResult):
|
||||||
|
with strategy._results_lock:
|
||||||
|
# only handlers have the listen attr, so this must be a handler
|
||||||
|
# we split up the results into two queues here to make sure
|
||||||
|
# handler and regular result processing don't cross wires
|
||||||
|
if 'listen' in result._task_fields:
|
||||||
|
strategy._handler_results.append(result)
|
||||||
|
else:
|
||||||
|
strategy._results.append(result)
|
||||||
else:
|
else:
|
||||||
strategy._results_lock.acquire()
|
display.warning('Received an invalid object (%s) in the result queue: %r' % (type(result), result))
|
||||||
# only handlers have the listen attr, so this must be a handler
|
|
||||||
# we split up the results into two queues here to make sure
|
|
||||||
# handler and regular result processing don't cross wires
|
|
||||||
if 'listen' in result._task_fields:
|
|
||||||
strategy._handler_results.append(result)
|
|
||||||
else:
|
|
||||||
strategy._results.append(result)
|
|
||||||
strategy._results_lock.release()
|
|
||||||
except (IOError, EOFError):
|
except (IOError, EOFError):
|
||||||
break
|
break
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
|
|
Loading…
Reference in a new issue