The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #23349

"Could not find value for $confdir" regression when using $confdir in puppet.conf

Added by Dominic Cleal over 2 years ago. Updated over 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:settings
Target version:3.4.0
Affected Puppet version: Branch:https://github.com/puppetlabs/puppet/pull/2127
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket is now tracked at: https://tickets.puppetlabs.com/browse/PUP-932


Description

This is a regression from 3.3.x to 3.4.0-rc1.

When puppet.conf contains the following:

[main]
    autosign = $confdir/autosign.conf

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

# 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

Related issues

Related to Puppet - Bug #23403: Error: Could not intialize global default settings: undef... Merged - Pending Release
Duplicates Puppet - Bug #23311: vardir default in 3.3.2 Duplicate

History

#1 Updated by Dominic Cleal over 2 years ago

bitsect points to aad83a8be02bd1ceaca2115dfed1a68df33d7015:

Author: Adrien Thebo 
Date:   Fri Nov 1 09:15:51 2013 -0700

    (maint) Ensure that the autosign setting is validated.
    
    Original patch by Patrick Hemmer 

#2 Updated by Adrien Thebo over 2 years ago

  • 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. 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, 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 but this only occurs when settings are defined; every time a setting is parsed all hooks are unconditionally 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.

#3 Updated by Anonymous over 2 years ago

  • Status changed from Accepted to Merged - Pending Release
  • Branch set to https://github.com/puppetlabs/puppet/pull/2127

Merged into stable in fd590b. This should go out in the next 3.4.0 RC. Thanks for finding this!

#4 Updated by Felix Frank over 2 years ago

  • Affected Puppet version deleted (3.4.0-rc1)

Ach! Guys, this is a duplicate of 23311. Way to make a man fear for his sanity after a pull ;-p

#5 Updated by Melissa Stone over 2 years ago

  • Status changed from Merged - Pending Release to Closed

Released in Puppet 3.4.0-rc2

#6 Updated by Charlie Sharpsteen over 2 years ago

Redmine Issue #23349 has been migrated to JIRA:

https://tickets.puppetlabs.com/browse/PUP-932

Also available in: Atom PDF