wait_for_connection - fix rediscovering ping interpreter for delegate_to

pull/82372/head
s-hertel 12 months ago
parent fe81164fe5
commit ecfc1b68fe

@ -79,6 +79,7 @@ class ActionBase(ABC):
# interpreter discovery state
self._discovered_interpreter_key = None
self._delegate_discovered_interpreter_key = None
self._discovered_interpreter = False
self._discovery_deprecation_warnings = []
self._discovery_warnings = []
@ -327,6 +328,8 @@ class ActionBase(ABC):
# preserve this so _execute_module can propagate back to controller as a fact
self._discovered_interpreter_key = discovered_key
else:
# allow action plugins to rediscover the delegate_to interpreter
self._delegate_discovered_interpreter_key = discovered_key
task_vars['ansible_delegated_vars'][self._task.delegate_to]['ansible_facts'][discovered_key] = self._discovered_interpreter
return (module_style, module_shebang, module_data, module_path)

@ -81,6 +81,8 @@ class ActionModule(ActionBase):
# re-run interpreter discovery if we ran it in the first iteration
if self._discovered_interpreter_key:
task_vars['ansible_facts'].pop(self._discovered_interpreter_key, None)
elif self._task.delegate_to and self._delegate_discovered_interpreter_key:
task_vars['ansible_delegated_vars'][self._task.delegate_to]['ansible_facts'].pop(self._delegate_discovered_interpreter_key)
# call connection reset between runs if it's there
try:
self._connection.reset()

Loading…
Cancel
Save