Puppet 3: $vardir also has to be set or it fails to interpolate
With Puppet 3, we call the initialize_global_settings method with the
--confdir and the value of the
:puppetconfdir setting. However if the puppet.conf references $vardir (which settings do by default) then
--vardir also has to be set when we initialise Puppet.
As mentioned in Jeff's comment here, this had to be added to the puppet config.ru for 3.0.1 too:
This is equivalent to how we initialise Puppet 3 today, which throws an error:
Other minor related problems:
irb(main):001:0> require 'puppet'
irb(main):002:0> Puppet.settings.initialize_global_settings(['--confdir', '/etc/puppet', '--run_mode', 'master'])
irb(main):003:0> puts Puppet[:hostcert]
Puppet::Settings::InterpolationError: Error converting value for param 'hostcert': Error converting value for param 'certdir': Error converting value for param 'ssldir': Could not find value for $vardir
:puppetconfdiris actually pointing to
/etc/puppet/puppet.confusually, so this should really be
:puppetconfdirwas removed in 7c08e30a47a16d387f26d1c617cdedc60d9d0582
- missing comma in my commit inside
fixes #1994 - set vardir for puppet 3, use --configprint
When running Puppet 3 as a non-root user (i.e. foreman), both --confdir and
--vardir have to be specified as per Puppet #16637, else SSL settings dependent
on vardir will fail.
This adds a new puppetvardir setting used with puppetconfdir, and supports
puppetconfdir being a file or directory due to historic settings.yaml examples.
It now shells out and uses `puppet master --configprint` to retrieve settings
to avoid changes in Puppet settings initialization logic across versions (e.g.
run_mode on Puppet 3).
#1 Updated by Dominic Cleal over 9 years ago
- Status changed from New to Assigned
- Assignee changed from Ohad Levy to Dominic Cleal
I don't particularly like the idea of having a Foreman setting for the Puppet vardir as it feels we're getting too internal. Perhaps this will go away with the refactor of Puppet settings in 3.1.
I'm going to try replacing this with simple calls to `puppet master --configprint` (or `puppetmasterd` as appropriate), which will work consistently across all versions and avoid getting into Puppet's application initialisation logic.
#2 Updated by Dominic Cleal over 9 years ago
":puppetconfdir was removed in 7c08e30a47a16d387f26d1c617cdedc60d9d0582"
This is causing the following error:
Error parsing arguments
(as reported in foreman-users: Trying to get Foreman working with Puppet 3)