mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-23 08:40:22 -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
|
@ -43,6 +43,7 @@ from ansible.template import Templar
|
|||
from ansible.utils.listify import listify_lookup_plugin_terms
|
||||
from ansible.utils.vars import combine_vars
|
||||
from ansible.vars.unsafe_proxy import wrap_var
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
|
@ -95,7 +96,6 @@ class VariableManager:
|
|||
|
||||
def __init__(self):
|
||||
|
||||
self._fact_cache = FactCache()
|
||||
self._nonpersistent_fact_cache = defaultdict(dict)
|
||||
self._vars_cache = defaultdict(dict)
|
||||
self._extra_vars = defaultdict(dict)
|
||||
|
@ -106,6 +106,14 @@ class VariableManager:
|
|||
self._omit_token = '__omit_place_holder__%s' % sha1(os.urandom(64)).hexdigest()
|
||||
self._options_vars = defaultdict(dict)
|
||||
|
||||
# bad cache plugin is not fatal error
|
||||
try:
|
||||
self._fact_cache = FactCache()
|
||||
except AnsibleError as e:
|
||||
display.warning(to_native(e))
|
||||
# fallback to a dict as in memory cache
|
||||
self._fact_cache = {}
|
||||
|
||||
def __getstate__(self):
|
||||
data = dict(
|
||||
fact_cache = self._fact_cache,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue