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
This commit is contained in:
Dag Wieers 2016-08-08 23:15:19 +02:00 committed by Brian Coca
parent 43febc76c9
commit 718f431466

View file

@ -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()