Restoring templating of hostvars returned by __getitem__

pull/13202/head
James Cammarata 9 years ago
parent 9f31c073fe
commit f10d2c57c8

@ -70,23 +70,14 @@ class HostVars(collections.Mapping):
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, play=self._play, include_hostvars=False)
#**************************************************** sha1_hash = sha1(str(data).encode('utf-8')).hexdigest()
# TESTING REMOVAL OF THIS if sha1_hash in self._cached_result:
#**************************************************** result = self._cached_result[sha1_hash]
# Since we template much later now in 2.0, it may be completely unrequired to do else:
# a full template of the vars returned above, which is quite costly in time when templar = Templar(variables=data, loader=self._loader)
# the result is large. result = templar.template(data, fail_on_undefined=False, static_vars=STATIC_VARS)
# Using cache in order to avoid template call self._cached_result[sha1_hash] = result
#sha1_hash = sha1(str(data).encode('utf-8')).hexdigest() return result
#if sha1_hash in self._cached_result:
# result = self._cached_result[sha1_hash]
#else:
# templar = Templar(variables=data, loader=self._loader)
# result = templar.template(data, fail_on_undefined=False, static_vars=STATIC_VARS)
# self._cached_result[sha1_hash] = result
#return result
#****************************************************
return data
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…
Cancel
Save