New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes #14447 - add cache around parser using serialised YAML file #135
Conversation
From quickscan looks good, I'll get to proper review and testing later. I agree that it nicely fits into Kafo core, we should be able to generate the same format using puppet-strings parser in kafo-export-params later. Would you mind opening a redmine issue and put all information you've mentioned there? I find it better place for keeping information, it's easier to find it later and associate with other issues. |
Yes, any parser in kafo_parsers that generates the standard format should be fine and work in exactly the same way. I'll probably look at the item on the puppet-strings PR to select available/ready parsers automatically.
Sure, done: http://projects.theforeman.org/issues/14447 |
e7d96c3
to
c7bbb62
Compare
I made a small update to change the serialised |
3b55e0b
to
78337c2
Compare
Rebased on master. |
return nil | ||
end | ||
|
||
new(parsed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you mind adding logger.debug "Using #{cache_path} cache with parsed modules"
in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, added.
I needed unrelated fix #141 in order to test it. Except one small comment it seems to work nicely. |
@domcleal sorry, it seems it needs another rebase |
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 peformance benefit. The cache can be generated with `kafo-export-params -f parsercache --no-parser-cache`. 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 normal.
Thanks, done. |
Great addition, thanks @domcleal! Merging. |
A cache of parsed modules can be configured with
:parser_cache_path
toskip 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
peformance benefit.
The cache can be generated with
kafo-export-params -f parsercache --no-parser-cache
.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
normal.
This is my suggested implementation of the third JSON-based parser mentioned at https://groups.google.com/d/msg/foreman-dev/Ijvodu1hJkE/Ssl83t35IAAJ and in theforeman/kafo_parsers#13.
I opted to put it in kafo rather than as a new parser in kafo_parsers for a few reasons:
This isn't everything for AIO support. The validations still require loading Puppet, but I will look at replacing Puppet functions with built in validations, and paths to
puppet
are not automatic.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.