@ -407,7 +407,7 @@ class VariableManager:
all_vars = _combine_and_track ( all_vars , self . _extra_vars , " extra vars " )
all_vars = _combine_and_track ( all_vars , self . _extra_vars , " extra vars " )
# before we add 'reserved vars', check we didn't add any reserved vars
# before we add 'reserved vars', check we didn't add any reserved vars
warn_if_reserved ( all_vars . keys ( ) )
warn_if_reserved ( all_vars )
# magic variables
# magic variables
all_vars = _combine_and_track ( all_vars , magic_variables , " magic vars " )
all_vars = _combine_and_track ( all_vars , magic_variables , " magic vars " )
@ -563,7 +563,8 @@ class VariableManager:
if not isinstance ( facts , Mapping ) :
if not isinstance ( facts , Mapping ) :
raise AnsibleAssertionError ( " the type of ' facts ' to set for host_facts should be a Mapping but is a %s " % type ( facts ) )
raise AnsibleAssertionError ( " the type of ' facts ' to set for host_facts should be a Mapping but is a %s " % type ( facts ) )
warn_if_reserved ( facts . keys ( ) )
warn_if_reserved ( facts )
try :
try :
host_cache = self . _fact_cache . get ( host )
host_cache = self . _fact_cache . get ( host )
except KeyError :
except KeyError :
@ -587,7 +588,8 @@ class VariableManager:
if not isinstance ( facts , Mapping ) :
if not isinstance ( facts , Mapping ) :
raise AnsibleAssertionError ( " the type of ' facts ' to set for nonpersistent_facts should be a Mapping but is a %s " % type ( facts ) )
raise AnsibleAssertionError ( " the type of ' facts ' to set for nonpersistent_facts should be a Mapping but is a %s " % type ( facts ) )
warn_if_reserved ( facts . keys ( ) )
warn_if_reserved ( facts )
try :
try :
self . _nonpersistent_fact_cache [ host ] | = facts
self . _nonpersistent_fact_cache [ host ] | = facts
except KeyError :
except KeyError :
@ -599,6 +601,7 @@ class VariableManager:
"""
"""
warn_if_reserved ( [ varname ] )
warn_if_reserved ( [ varname ] )
if host not in self . _vars_cache :
if host not in self . _vars_cache :
self . _vars_cache [ host ] = dict ( )
self . _vars_cache [ host ] = dict ( )