mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-02 22:39:09 -07:00
bad/missing fact plugin is a warning (#19350)
This commit is contained in:
parent
739a310382
commit
f550b4541f
2 changed files with 12 additions and 11 deletions
13
lib/ansible/plugins/cache/__init__.py
vendored
13
lib/ansible/plugins/cache/__init__.py
vendored
|
@ -33,24 +33,17 @@ except ImportError:
|
|||
class FactCache(MutableMapping):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
self._plugin = cache_loader.get(C.CACHE_PLUGIN)
|
||||
if not self._plugin:
|
||||
raise AnsibleError('Unable to load the facts cache plugin (%s)\n'
|
||||
'Check fact cache config options :\n'
|
||||
'Current values:\n'
|
||||
' fact_caching: %s\n'
|
||||
' fact_caching_connection: %s' %
|
||||
(C.CACHE_PLUGIN, C.CACHE_PLUGIN, C.CACHE_PLUGIN_CONNECTION))
|
||||
raise AnsibleError('Unable to load the facts cache plugin (%s).' % (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:
|
||||
display.warning("Failed to load fact cache plugins")
|
||||
return
|
||||
|
||||
def __getitem__(self, key):
|
||||
if key not in self:
|
||||
if not self._plugin.contains(key):
|
||||
raise KeyError
|
||||
return self._plugin.get(key)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue