mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make sure hostvars cache is recreated during serialization
This commit is contained in:
parent
5040abaaf2
commit
dd4ca66e1e
1 changed files with 8 additions and 2 deletions
|
@ -51,7 +51,7 @@ class HostVars(collections.Mapping):
|
||||||
self._loader = loader
|
self._loader = loader
|
||||||
self._play = play
|
self._play = play
|
||||||
self._variable_manager = variable_manager
|
self._variable_manager = variable_manager
|
||||||
self._cached_result = {}
|
self._cached_result = dict()
|
||||||
|
|
||||||
hosts = inventory.get_hosts(ignore_limits_and_restrictions=True)
|
hosts = inventory.get_hosts(ignore_limits_and_restrictions=True)
|
||||||
|
|
||||||
|
@ -106,10 +106,16 @@ class HostVars(collections.Mapping):
|
||||||
return len(self._lookup)
|
return len(self._lookup)
|
||||||
|
|
||||||
def __getstate__(self):
|
def __getstate__(self):
|
||||||
return dict(loader=self._loader, lookup=self._lookup, play=self._play, var_manager=self._variable_manager)
|
return dict(
|
||||||
|
loader=self._loader,
|
||||||
|
lookup=self._lookup,
|
||||||
|
play=self._play,
|
||||||
|
var_manager=self._variable_manager,
|
||||||
|
)
|
||||||
|
|
||||||
def __setstate__(self, data):
|
def __setstate__(self, data):
|
||||||
self._play = data.get('play')
|
self._play = data.get('play')
|
||||||
self._loader = data.get('loader')
|
self._loader = data.get('loader')
|
||||||
self._lookup = data.get('lookup')
|
self._lookup = data.get('lookup')
|
||||||
self._variable_manager = data.get('var_manager')
|
self._variable_manager = data.get('var_manager')
|
||||||
|
self._cached_result = dict()
|
||||||
|
|
Loading…
Reference in a new issue