From d4bf3127ec2d0353f69d255c621613d4d7d8bfef Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Fri, 19 Dec 2014 13:21:55 +0100 Subject: [PATCH] Add a explicit error when fact_caching_connection is not set By default, jsonfile is not documented, and the error message when fact_caching_connection is not set is a bit puzzling, so a error message would be beeter ( documentation too ). While redis is faster for bigger setup, jsonfile is fine for a small setup and is easier to deploy. The module will then stop ansible-playbook, as this match better the philosophy of Ansible being a fail-fast system. --- lib/ansible/cache/jsonfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/cache/jsonfile.py b/lib/ansible/cache/jsonfile.py index 8b4c892a40..ca18974d3c 100644 --- a/lib/ansible/cache/jsonfile.py +++ b/lib/ansible/cache/jsonfile.py @@ -34,6 +34,8 @@ class CacheModule(BaseCacheModule): self._timeout = float(C.CACHE_PLUGIN_TIMEOUT) self._cache = {} self._cache_dir = C.CACHE_PLUGIN_CONNECTION # expects a dir path + if not self._cache_dir: + utils.exit("error, fact_caching_connection is not set, cannot use fact cache") if not os.path.exists(self._cache_dir): try: