mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-01 00:03:10 +00:00
Fix error using jsonfile with incomplete config (#17567)
If 'fact_caching=jsonfile' was configured, but 'fact_caching_connection' was not configured, jsonfile would fail and ansible-playbook would exit with a traceback. Fixes #17566
This commit is contained in:
6
lib/ansible/plugins/cache/jsonfile.py
vendored
6
lib/ansible/plugins/cache/jsonfile.py
vendored
@@ -50,7 +50,11 @@ class CacheModule(BaseCacheModule):
|
||||
|
||||
self._timeout = float(C.CACHE_PLUGIN_TIMEOUT)
|
||||
self._cache = {}
|
||||
self._cache_dir = os.path.expanduser(os.path.expandvars(C.CACHE_PLUGIN_CONNECTION))
|
||||
self._cache_dir = None
|
||||
|
||||
if C.CACHE_PLUGIN_CONNECTION:
|
||||
# expects a dir path
|
||||
self._cache_dir = os.path.expanduser(os.path.expandvars(C.CACHE_PLUGIN_CONNECTION))
|
||||
|
||||
if not self._cache_dir:
|
||||
raise AnsibleError("error, 'jsonfile' cache plugin requires the 'fact_caching_connection' config option to be set (to a writeable directory path)")
|
||||
|
||||
Reference in New Issue
Block a user