mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-03 20:54:24 -07:00
Make sure registered variable message is sent before other messages
Avoids a race condition where previously the registered variable message was being sent after the 'host_task_ok' message, meaning the next task may be started before the var is registered, leading to an undefined variable error
This commit is contained in:
parent
8cfec0a27a
commit
daa319881f
1 changed files with 3 additions and 5 deletions
|
@ -105,7 +105,9 @@ class ResultProcess(multiprocessing.Process):
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
host_name = result._host.get_name()
|
# if this task is registering a result, do it now
|
||||||
|
if result._task.register:
|
||||||
|
self._send_result(('set_host_var', result._host, result._task.register, result._result))
|
||||||
|
|
||||||
# send callbacks, execute other options based on the result status
|
# send callbacks, execute other options based on the result status
|
||||||
# FIXME: this should all be cleaned up and probably moved to a sub-function.
|
# FIXME: this should all be cleaned up and probably moved to a sub-function.
|
||||||
|
@ -160,10 +162,6 @@ class ResultProcess(multiprocessing.Process):
|
||||||
# finally, send the ok for this task
|
# finally, send the ok for this task
|
||||||
self._send_result(('host_task_ok', result))
|
self._send_result(('host_task_ok', result))
|
||||||
|
|
||||||
# if this task is registering a result, do it now
|
|
||||||
if result._task.register:
|
|
||||||
self._send_result(('set_host_var', result._host, result._task.register, result._result))
|
|
||||||
|
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
pass
|
pass
|
||||||
except (KeyboardInterrupt, IOError, EOFError):
|
except (KeyboardInterrupt, IOError, EOFError):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue