Issue #23349 has been updated by Adrien Thebo.

Status changed from Unreviewed to Accepted

The reason this is occurring is that defining a hook on a setting can force 
that value to be interpolated before all settings are loaded, which can cause 
interpolation to fail.

Settings with hooks have their hooks invoked every time that setting is parsed 
(`Puppet::Settings#unsafe_parse`)[https://github.com/puppetlabs/puppet/blob/3.4.0-rc1/lib/puppet/settings.rb#L593].
 Invoking a hook requires that the setting value is interpolated, which means 
that all values to interpolate must be loaded when the hook is invoked. Lastly 
we evaluate global settings before application settings 
(`Puppet.do_initialize_settings_for_run_mode`)[https://github.com/puppetlabs/puppet/blob/3.4.0-rc1/lib/puppet.rb#L148-L150],
 which means that global settings that interpolate application settings can 
only be evaluated after application settings have been initialized. There is 
functionality to defer the evaluation of settings hooks after application 
initialization 
(`Puppet::Settings#define_settings`)[https://github.com/puppetlabs/puppet/blob/3.4.0-rc1/lib/puppet/settings.rb#L853-L854]
 but this only occurs when settings are defined; every time a setting is parsed 
all hooks are u
 nconditionally run. This means that if a global setting like autosign 
interpolates an application setting (`autosign = $confdir/autosign.conf`) and 
defines a hook, the hook will be called too early and fail to interpolate.

This issue should be fixed in a few ways. First off, setting hooks should not 
be used to perform validation. Settings validation is generally handled by the 
`Puppet::Settings::BaseSetting#munge` method that's overridden by childen, so 
we should move the validation to the `#munge` method. Secondly, settings need 
to be able to defer hooks from parse time to post application initialization so 
that the values can safely be interpolated.

----------------------------------------
Bug #23349: "Could not find value for $confdir" regression when using $confdir 
in puppet.conf
https://projects.puppetlabs.com/issues/23349#change-101036

* Author: Dominic Cleal
* Status: Accepted
* Priority: Normal
* Assignee: 
* Category: settings
* Target version: 3.4.0
* Affected Puppet version: 3.4.0-rc1
* Keywords: 
* Branch: 
----------------------------------------
This is a regression from 3.3.x to 3.4.0-rc1.

When puppet.conf contains the following:

<pre>
[main]
    autosign = $confdir/autosign.conf
</pre>

All puppet commands fail as the $confdir can't be interpolated.

<pre>
# puppet --version
3.3.2
# puppet apply --configprint autosign
/etc/puppet/autosign.conf
# yum upgrade --enablerepo=puppetlabs-devel puppet
[snip, updated to 3.4.0-rc1]
# rpm -q puppet
puppet-3.4.0-0.1rc1.el6.noarch
# puppet apply --configprint autosign
Error: Could not intialize global default settings: Error converting value for 
param 'autosign': Could not find value for $confdir
# puppet --version
Error: Could not intialize global default settings: Error converting value for 
param 'autosign': Could not find value for $confdir
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to