mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #13307 from Yannig/devel_fix_big_include_vars
Fix for https://github.com/ansible/ansible/issues/13221
This commit is contained in:
commit
dfa576b037
3 changed files with 14 additions and 2 deletions
|
@ -202,6 +202,7 @@ class TaskQueueManager:
|
||||||
# to do this with a proper BaseProxy/DictProxy derivative
|
# to do this with a proper BaseProxy/DictProxy derivative
|
||||||
exposed=(
|
exposed=(
|
||||||
'set_variable_manager', 'set_inventory', '__contains__', '__delitem__',
|
'set_variable_manager', 'set_inventory', '__contains__', '__delitem__',
|
||||||
|
'set_nonpersistent_facts', 'set_host_facts', 'set_host_variable',
|
||||||
'__getitem__', '__len__', '__setitem__', 'clear', 'copy', 'get', 'has_key',
|
'__getitem__', '__len__', '__setitem__', 'clear', 'copy', 'get', 'has_key',
|
||||||
'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values'
|
'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values'
|
||||||
),
|
),
|
||||||
|
|
|
@ -273,7 +273,7 @@ class StrategyBase:
|
||||||
var_value = wrap_var(result[3])
|
var_value = wrap_var(result[3])
|
||||||
|
|
||||||
self._variable_manager.set_nonpersistent_facts(host, {var_name: var_value})
|
self._variable_manager.set_nonpersistent_facts(host, {var_name: var_value})
|
||||||
self._tqm._hostvars_manager.hostvars().set_variable_manager(self._variable_manager)
|
self._tqm._hostvars_manager.hostvars().set_nonpersistent_facts(host, {var_name: var_value})
|
||||||
|
|
||||||
elif result[0] in ('set_host_var', 'set_host_facts'):
|
elif result[0] in ('set_host_var', 'set_host_facts'):
|
||||||
host = result[1]
|
host = result[1]
|
||||||
|
@ -298,13 +298,15 @@ class StrategyBase:
|
||||||
var_value = result[5]
|
var_value = result[5]
|
||||||
|
|
||||||
self._variable_manager.set_host_variable(target_host, var_name, var_value)
|
self._variable_manager.set_host_variable(target_host, var_name, var_value)
|
||||||
|
self._tqm._hostvars_manager.hostvars().set_host_variable(target_host, var_name, var_value)
|
||||||
elif result[0] == 'set_host_facts':
|
elif result[0] == 'set_host_facts':
|
||||||
facts = result[4]
|
facts = result[4]
|
||||||
if task.action == 'set_fact':
|
if task.action == 'set_fact':
|
||||||
self._variable_manager.set_nonpersistent_facts(target_host, facts)
|
self._variable_manager.set_nonpersistent_facts(target_host, facts)
|
||||||
|
self._tqm._hostvars_manager.hostvars().set_nonpersistent_facts(target_host, facts)
|
||||||
else:
|
else:
|
||||||
self._variable_manager.set_host_facts(target_host, facts)
|
self._variable_manager.set_host_facts(target_host, facts)
|
||||||
self._tqm._hostvars_manager.hostvars().set_variable_manager(self._variable_manager)
|
self._tqm._hostvars_manager.hostvars().set_host_facts(target_host, facts)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise AnsibleError("unknown result message received: %s" % result[0])
|
raise AnsibleError("unknown result message received: %s" % result[0])
|
||||||
|
|
|
@ -79,6 +79,15 @@ class HostVars(collections.Mapping):
|
||||||
self._cached_result[sha1_hash] = result
|
self._cached_result[sha1_hash] = result
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def set_host_variable(self, host, varname, value):
|
||||||
|
self._variable_manager.set_host_variable(host, varname, value)
|
||||||
|
|
||||||
|
def set_nonpersistent_facts(self, host, facts):
|
||||||
|
self._variable_manager.set_nonpersistent_facts(host, facts)
|
||||||
|
|
||||||
|
def set_host_facts(self, host, facts):
|
||||||
|
self._variable_manager.set_host_facts(host, facts)
|
||||||
|
|
||||||
def __contains__(self, host_name):
|
def __contains__(self, host_name):
|
||||||
return self._find_host(host_name) is not None
|
return self._find_host(host_name) is not None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue