mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Port cache plugins to global display
This commit is contained in:
parent
b05d0b8c9c
commit
2bd695ed42
2 changed files with 20 additions and 11 deletions
5
lib/ansible/plugins/cache/__init__.py
vendored
5
lib/ansible/plugins/cache/__init__.py
vendored
|
@ -20,7 +20,6 @@ __metaclass__ = type
|
|||
from collections import MutableMapping
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins import cache_loader
|
||||
|
||||
try:
|
||||
|
@ -29,14 +28,16 @@ except ImportError:
|
|||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
|
||||
class FactCache(MutableMapping):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._plugin = cache_loader.get(C.CACHE_PLUGIN)
|
||||
# Backwards compat: self._display isn't really needed, just import the global display and use that.
|
||||
self._display = display
|
||||
|
||||
if self._plugin is None:
|
||||
self._display.warning("Failed to load fact cache plugins")
|
||||
display.warning("Failed to load fact cache plugins")
|
||||
return
|
||||
|
||||
def __getitem__(self, key):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue