diff --git a/lib/ansible/executor/task_queue_manager.py b/lib/ansible/executor/task_queue_manager.py index 0f8f16ee6c..d665000046 100644 --- a/lib/ansible/executor/task_queue_manager.py +++ b/lib/ansible/executor/task_queue_manager.py @@ -188,7 +188,6 @@ class TaskQueueManager: pass hostvars = HostVars( - play=new_play, inventory=self._inventory, variable_manager=self._variable_manager, loader=self._loader, diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index 2c9d8aca33..d636e8d4b9 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -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] diff --git a/lib/ansible/vars/hostvars.py b/lib/ansible/vars/hostvars.py index a82e683d74..afa00ec8a4 100644 --- a/lib/ansible/vars/hostvars.py +++ b/lib/ansible/vars/hostvars.py @@ -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: