mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02: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:
parent
29fda4be1e
commit
3e754086b6
1 changed files with 5 additions and 1 deletions
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)")
|
||||
|
|
Loading…
Add table
Reference in a new issue