fixes #5856 - use public initializer for Puppet settings #161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR swaps calling fairly private methods with calling the public API for initialising settings.
The reason we used to do this when adding support for Puppet 3 was that we relied on Puppet itself to parse its config file, and then pulled the parsed data structure out of its settings object. Since Puppet reads a different config file depending on which "run mode" it's in (master, agent, user (misc)), we had to force it into master so it read the same puppet.conf that the puppet master itself would be using.
Recently I replaced the code that pulled the parsed config out of Puppet with an Augeas-based implementation in dd37400, so we no longer have a requirement to load Puppet in master mode. Now the default "user" mode (used for programs 'requiring' Puppet and non-agent/master Puppet apps) will suffice, because we generally don't care about where it loads settings from.
Puppet 3.6 now broke this initialisation code because it added a new step internally ("context") that we weren't initialising. You can see this here: https://github.com/puppetlabs/puppet/blob/3.6.0/lib/puppet.rb#L150-L153
So the upshot of this is that we might as well KISS and go back to the public API for initialising settings, forgetting all about run modes: https://github.com/puppetlabs/puppet/blob/3.6.0/lib/puppet.rb#L127-L132
I've tested this on Puppet 3.6.0 and 3.0.0 and with the following puppet.conf files:
Jenkins will also test a large number of Puppet versions.