From 718f431466ba01a96328f51417d429269fb964e4 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Mon, 8 Aug 2016 23:15:19 +0200 Subject: [PATCH] Allow to make the jsonfile cache files pretty (indented and sorted) (#17000) * Allow to make the jsonfile cache files pretty (indented and sorted) Since the json cache files are condensed, it is not very practical to look for something in them. Having indented/sorted cache files makes debugging and playbook/inventory development a lot easier to do. I made it configurable in case people would object to the performance hit this would have, but to be honest, then they probably should be looking at other cache plugins instead IMO. * Removed the config option and documentation changes --- lib/ansible/plugins/cache/jsonfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/plugins/cache/jsonfile.py b/lib/ansible/plugins/cache/jsonfile.py index 1bf0ea10b6e..1ee183e0946 100644 --- a/lib/ansible/plugins/cache/jsonfile.py +++ b/lib/ansible/plugins/cache/jsonfile.py @@ -99,7 +99,7 @@ class CacheModule(BaseCacheModule): display.warning("error while trying to write to %s : %s" % (cachefile, to_bytes(e))) pass else: - f.write(jsonify(value)) + f.write(jsonify(value, format=True)) finally: try: f.close()