Fixing up fact_cache use in VariableManager
parent
932d1e57f7
commit
d977da5b41
|
@ -73,7 +73,7 @@ class CacheModule(BaseCacheModule):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# FIXME: this is in display now, but cache plugins don't have that
|
# FIXME: this is in display now, but cache plugins don't have that
|
||||||
#utils.warning("error while trying to write to %s : %s" % (cachefile, str(e)))
|
#utils.warning("error while trying to write to %s : %s" % (cachefile, str(e)))
|
||||||
return dict()
|
raise KeyError
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,10 @@ class VariableManager:
|
||||||
all_vars = self._combine_vars(all_vars, host.get_vars())
|
all_vars = self._combine_vars(all_vars, host.get_vars())
|
||||||
|
|
||||||
# next comes the facts cache and the vars cache, respectively
|
# next comes the facts cache and the vars cache, respectively
|
||||||
all_vars = self._combine_vars(all_vars, self._fact_cache.get(host.get_name(), dict()))
|
try:
|
||||||
|
all_vars = self._combine_vars(all_vars, self._fact_cache.get(host.name, dict()))
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
if play:
|
if play:
|
||||||
all_vars = self._combine_vars(all_vars, play.get_vars())
|
all_vars = self._combine_vars(all_vars, play.get_vars())
|
||||||
|
@ -345,11 +348,13 @@ class VariableManager:
|
||||||
|
|
||||||
assert isinstance(facts, dict)
|
assert isinstance(facts, dict)
|
||||||
|
|
||||||
host_name = host.get_name()
|
if host.name not in self._fact_cache:
|
||||||
if host_name not in self._fact_cache:
|
self._fact_cache[host.name] = facts
|
||||||
self._fact_cache[host_name] = facts
|
|
||||||
else:
|
else:
|
||||||
self._fact_cache[host_name].update(facts)
|
try:
|
||||||
|
self._fact_cache[host.name].update(facts)
|
||||||
|
except KeyError:
|
||||||
|
self._fact_cache[host.name] = facts
|
||||||
|
|
||||||
def set_host_variable(self, host, varname, value):
|
def set_host_variable(self, host, varname, value):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in New Issue