Issue #20308 has been updated by Andrew Forgue.
I think I was a bit hasty thinking it was a client/server version mismatch
issue, it happens with both 3.2.0 clients and 3.2.0 servers.
I did some digging around with a colleague and we discovered that there's a
particular trigger to when recursion will stop. On line 141 in file
lib/file_serving/fileset.rb
<pre>while dir_path = current_dirs.shift
next unless stat = stat(dir_path)
next unless stat.directory?
Dir.entries(dir_path).each do |file_path|
next if [".", ".."].include?(file_path)
# Note that this also causes matching directories not
# to be recursed into.
next if ignore?(file_path)
# Add it to our list of files to return
result << File.join(dir_path, file_path)
# And to our list of files/directories to iterate over.
next_dirs << File.join(dir_path, file_path)
end
# Move to the next recusion level
if current_dirs.empty?
depth += 1
break unless recurse?(depth)
current_dirs = next_dirs
next_dirs = []
end
end</pre>
In this code if current_dirs ONLY consists of NON-directories (e.g. facts,
etc), then the directories in next_dirs is never processed.
Here's the last iteration that gets passed the 'next unless stat.directory?'
line (from an awesome print line just before 'if current_dirs.empty?':
<pre>{
:next_path => [
[0]
"/etc/puppet/environments/production/modules/baseos/lib/puppet/provider/package"
],
:current_path => [
[0]
"/etc/puppet/environments/production/modules/baseos/lib/facter/bonding.rb",
[1]
"/etc/puppet/environments/production/modules/baseos/lib/facter/host_to_components.rb",
[2]
"/etc/puppet/environments/production/modules/baseos/lib/facter/uuid.rb"
]
}</pre>
The next three iterations of the loop are files, and it triggers the 'next
unless stat.directory?' and the result is that it ignores the remaining data in
next_dirs.
This bug exists if and only if the last element in current_dirs is not a
directory or stat() fails (EPERM, dangling symlink, etc).
I *think* this patch would fix it:
<pre>
diff --git a/lib/puppet/file_serving/fileset.rb
b/lib/puppet/file_serving/fileset.rb
index 96050b6..5e35ed8 100644
--- a/lib/puppet/file_serving/fileset.rb
+++ b/lib/puppet/file_serving/fileset.rb
@@ -137,21 +137,22 @@ class Puppet::FileServing::Fileset
return result unless recurse?(depth)
while dir_path = current_dirs.shift
- next unless stat = stat(dir_path)
- next unless stat.directory?
+ stat = stat(dir_path)
- Dir.entries(dir_path).each do |file_path|
- next if [".", ".."].include?(file_path)
+ if stat.respond_to?(:directory?) && stat.directory?
+ Dir.entries(dir_path).each do |file_path|
+ next if [".", ".."].include?(file_path)
- # Note that this also causes matching directories not
- # to be recursed into.
- next if ignore?(file_path)
+ # Note that this also causes matching directories not
+ # to be recursed into.
+ next if ignore?(file_path)
- # Add it to our list of files to return
- result << File.join(dir_path, file_path)
+ # Add it to our list of files to return
+ result << File.join(dir_path, file_path)
- # And to our list of files/directories to iterate over.
- next_dirs << File.join(dir_path, file_path)
+ # And to our list of files/directories to iterate over.
+ next_dirs << File.join(dir_path, file_path)
+ end
end
# Move to the next recusion level
</pre>
----------------------------------------
Bug #20308: pluginsync of a 3.1.1 client on a 3.2rc1 server deletes some plugins
https://projects.puppetlabs.com/issues/20308#change-89740
* Author: Andrew Forgue
* Status: Investigating
* Priority: High
* Assignee: Charlie Sharpsteen
* Category: plug-ins
* Target version:
* Affected Puppet version: 3.2.0-rc1
* Keywords:
* Branch:
----------------------------------------
If I run a 3.1.1 (or 2.7.17) client against a 3.2.0rc1 server, a lot of the
plugins get deleted:
<pre>
uppet]$ sudo puppet agent -t --pluginsync --server puppet
Info: Retrieving plugin
Notice:
/File[/var/lib/puppet/lib/puppet/parser/functions/validate_hash.rb]/ensure:
removed
Notice:
/File[/var/lib/puppet/lib/puppet/parser/functions/validate_bool.rb]/ensure:
removed
Notice:
/File[/var/lib/puppet/lib/puppet/parser/functions/get_module_path.rb]/ensure:
removed
Notice:
/File[/var/lib/puppet/lib/puppet/parser/functions/is_ip_address.rb]/ensure:
removed
Notice:
/File[/var/lib/puppet/lib/puppet/parser/functions/is_numeric.rb]/ensure: removed
Notice: /File[/var/lib/puppet/lib/puppet/parser/functions/delete.rb]/ensure:
removed
Notice:
/File[/var/lib/puppet/lib/puppet/parser/functions/is_domain_name.rb]/ensure:
removed
Notice:
/File[/var/lib/puppet/lib/puppet/parser/functions/validate_absolute_path.rb]/ensure:
removed
Notice: /File[/var/lib/puppet/lib/puppet/parser/functions/has_key.rb]/ensure:
removed
Notice: /File[/var/lib/puppet/lib/puppet/parser/functions/flatten.rb]/ensure:
removed
Notice:
/File[/var/lib/puppet/lib/puppet/parser/functions/is_mac_address.rb]/ensure:
removed
...
</pre>
If I upgrade the client to 3.2.0rc1, the plugins come back.
If the server and the client is on 3.1.1, then the plugins appear to work fine.
So it seems like the pluginsync isn't working properly on a 3.2.0rc1 server
against older clients.
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.