Issue #10991 has been updated by Matthaus Litteken.

Status changed from Unreviewed to Accepted


----------------------------------------
Bug #10991: puppet agent --genconfig generates unusable config
https://projects.puppetlabs.com/issues/10991

Author: Josh Cooper
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.6.0
Keywords: 
Branch: 


It's pretty common to get puppet agent running with a set of command line 
arguments, e.g. --server, and then run --genconfig, and have puppet just use 
that. The problem is if puppet has performed fact syncing, so the vardir/facts 
directory exists, then puppet agent will not start, because it thinks 
vardir/facts should be a file and will refuse to remove the existing directory.

This issue occurs because Puppet::Util::Settings::FileSetting#type relies on 
either the setting name containing 'dir' or that the value ends with a trailing 
slash. The setting as contained in the defaults.rb (or output by genconfig) 
does contain a trailing slash.

But Puppet::Util::Settings::FileSettings#munge uses File.expand_path which 
strips the trailing slash off. This change was made in commit:97c043f4

This is occurs on Mac and I've seen it on windows too.

To reproduce:

<pre>
$ puppet agent --test
...
$ ll ~/.puppet/var/
...
drwxr-xr-x  2 josh  staff    68B Oct 31 22:11 facts/
$ puppet agent --genconfig > puppet.conf
$ puppet agent --config puppet.conf
Could not prepare for execution: Got 1 failure(s) while initializing: change 
from directory to file failed: Could not set 'file on ensure: Is a directory - 
/Users/josh/.puppet/var/facts
</pre>

Comment out the following, then it will start:
<pre>
#factdest = /Users/josh/.puppet/var/facts/
</pre>
Or remove existing directory, and it will start:

<pre>
$ rm -rf ~/.puppet
$ puppet agent --config puppet.conf
</pre>

Relying on a trailing slash is extremely fragile


-- 
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to