mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-04 07:19:10 -07:00
Revert "fix cache 'update' method to be 'mapping' compatible"
This reverts commit 68301f890a
.
This commit is contained in:
parent
e4a3e73b15
commit
d06cd869b8
3 changed files with 19 additions and 28 deletions
18
lib/ansible/plugins/cache/__init__.py
vendored
18
lib/ansible/plugins/cache/__init__.py
vendored
|
@ -289,18 +289,10 @@ class FactCache(MutableMapping):
|
|||
""" Flush the fact cache of all keys. """
|
||||
self._plugin.flush()
|
||||
|
||||
def update(self, host_facts):
|
||||
""" We override the normal update to ensure we always use the 'setter' method """
|
||||
for key in host_facts:
|
||||
try:
|
||||
host_cache = self._plugin.get(key)
|
||||
if host_cache:
|
||||
host_cache.update(host_facts[key])
|
||||
else:
|
||||
host_cache = host_facts[key]
|
||||
self._plugin.set(key, host_cache)
|
||||
except KeyError:
|
||||
self._plugin.set(key, host_facts[key])
|
||||
def update(self, key, value):
|
||||
host_cache = self._plugin.get(key)
|
||||
host_cache.update(value)
|
||||
self._plugin.set(key, host_cache)
|
||||
|
||||
|
||||
class InventoryFileCacheModule(BaseFileCacheModule):
|
||||
|
@ -319,7 +311,7 @@ class InventoryFileCacheModule(BaseFileCacheModule):
|
|||
def validate_cache_connection(self):
|
||||
try:
|
||||
super(InventoryFileCacheModule, self).validate_cache_connection()
|
||||
except AnsibleError:
|
||||
except AnsibleError as e:
|
||||
cache_connection_set = False
|
||||
else:
|
||||
cache_connection_set = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue