Add serialised cache of parsed manifests
This tickets covers the idea of a third JSON-based parser mentioned at https://groups.google.com/d/msg/foreman-dev/Ijvodu1hJkE/Ssl83t35IAAJ and in https://github.com/theforeman/kafo_parsers/pull/13. However, instead of a JSON-based parser in kafo_parsers, adding a cache from a serialised file around the parser in Kafo itself would have a few benefits:
- Kafo already had kafo-export-params, which I thought would be the perfect tool to extend to generate the YAML files. It already handles loading the configuration, output formats etc, so adding a new output format for the cache is trivial.
- If extending kafo-export-params to write the cache, it made sense to keep the cache reader and writer in the same project so it's easy to keep in sync.
- The cache location can be set in the Kafo configuration, which is hard to access from kafo_parsers right now.
This helps with support for Puppet AIO packages as when the cache is in use, there's no need to load the Puppet dependency in kafo_parsers.
This does delay the requirement for a puppet-strings parser, as we can generate the parser cache on the current Puppet 3 installation at build time and use it with a Puppet 4 AIO installation. It also means users won't have to install puppet-strings. We will still want a puppet-strings parser so we're not limited to building on Puppet 3.
fixes #14447 - add cache around parser using YAML file
A cache of parsed modules can be configured with `:parser_cache_path` to
skip calls out to kafo_parsers when loading Puppet modules. This helps
when no parser is available for the current Puppet installation (e.g.
under Puppet 4 with AIO at the time of writing), and may provide a small
The cache can be generated with `kafo-export-params -f parsercache
The cache is skipped if the mtime of the manifest is greater than the
mtime when the cache was generated, causing Kafo to use kafo_parsers as