parent
8ff67e0494
commit
a183972477
3 changed files with 4 additions and 17 deletions
|
@ -188,7 +188,6 @@ class TaskQueueManager:
|
|||
pass
|
||||
|
||||
hostvars = HostVars(
|
||||
play=new_play,
|
||||
inventory=self._inventory,
|
||||
variable_manager=self._variable_manager,
|
||||
loader=self._loader,
|
||||
|
|
|
@ -43,7 +43,6 @@ from ansible.template import Templar
|
|||
from ansible.utils.debug import debug
|
||||
from ansible.utils.listify import listify_lookup_plugin_terms
|
||||
from ansible.utils.vars import combine_vars
|
||||
from ansible.vars.hostvars import HostVars
|
||||
from ansible.vars.unsafe_proxy import wrap_var
|
||||
|
||||
try:
|
||||
|
@ -171,7 +170,8 @@ class VariableManager:
|
|||
|
||||
return data
|
||||
|
||||
|
||||
# FIXME: include_hostvars is no longer used, and should be removed, but
|
||||
# all other areas of code calling get_vars need to be fixed too
|
||||
def get_vars(self, loader, play=None, host=None, task=None, include_hostvars=True, include_delegate_to=True, use_cache=True):
|
||||
'''
|
||||
Returns the variables, with optional "context" given via the parameters
|
||||
|
@ -367,17 +367,6 @@ class VariableManager:
|
|||
variables['groups'] = dict()
|
||||
for (group_name, group) in iteritems(self._inventory.groups):
|
||||
variables['groups'][group_name] = [h.name for h in group.get_hosts()]
|
||||
|
||||
#if include_hostvars:
|
||||
# hostvars_cache_entry = self._get_cache_entry(play=play)
|
||||
# if hostvars_cache_entry in HOSTVARS_CACHE:
|
||||
# hostvars = HOSTVARS_CACHE[hostvars_cache_entry]
|
||||
# else:
|
||||
# hostvars = HostVars(play=play, inventory=self._inventory, loader=loader, variable_manager=self)
|
||||
# HOSTVARS_CACHE[hostvars_cache_entry] = hostvars
|
||||
# variables['hostvars'] = hostvars
|
||||
# variables['vars'] = hostvars[host.get_name()]
|
||||
|
||||
if play:
|
||||
variables['role_names'] = [r._role_name for r in play.roles]
|
||||
|
||||
|
|
|
@ -46,11 +46,10 @@ __all__ = ['HostVars']
|
|||
class HostVars(collections.Mapping):
|
||||
''' A special view of vars_cache that adds values from the inventory when needed. '''
|
||||
|
||||
def __init__(self, play, inventory, variable_manager, loader):
|
||||
def __init__(self, inventory, variable_manager, loader):
|
||||
self._lookup = dict()
|
||||
self._inventory = inventory
|
||||
self._loader = loader
|
||||
self._play = play
|
||||
self._variable_manager = variable_manager
|
||||
self._cached_result = dict()
|
||||
|
||||
|
@ -68,7 +67,7 @@ class HostVars(collections.Mapping):
|
|||
if host is None:
|
||||
raise j2undefined
|
||||
|
||||
data = self._variable_manager.get_vars(loader=self._loader, host=host, play=self._play, include_hostvars=False)
|
||||
data = self._variable_manager.get_vars(loader=self._loader, host=host, include_hostvars=False)
|
||||
|
||||
sha1_hash = sha1(str(data).encode('utf-8')).hexdigest()
|
||||
if sha1_hash in self._cached_result:
|
||||
|
|
Loading…
Reference in a new issue