[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585
James Turnbull
james at lovedthanlost.net
Fri Jan 23 14:21:20 UTC 2009
The following commit has been merged in the master branch:
commit 28534471ef91301cc6a270f826dfff0f6021f89e
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date: Sun Oct 5 17:11:38 2008 +0200
Fix several small regressions in plugins mount
Since a30ecf2aeffd71960bd806fb28cd6d1b8adc2452, reclist has one parameter
less, but Puppet::Network::Handler::PluginMount.list wasn't ported to the
new API.
While mounting plugins, reclist wasn't requiring 'file_serving/fileset',
leading to an NameError.
The change to the new API meant that we lost the existance test of plugins
mount directory. It was failing when the client was mounting module plugins that
weren't existing (like facter and no custom facts defined).
Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>
diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb
index da0a2be..d87eb83 100755
--- a/lib/puppet/network/handler/fileserver.rb
+++ b/lib/puppet/network/handler/fileserver.rb
@@ -653,8 +653,6 @@ class Puppet::Network::Handler
# and "bad batch".
#
def list(relpath, recurse, ignore, client = nil)
- require 'puppet/file_serving'
- require 'puppet/file_serving/fileset'
abspath = file_path(relpath, client)
if FileTest.exists?(abspath)
if FileTest.directory?(abspath) and recurse
@@ -667,6 +665,8 @@ class Puppet::Network::Handler
end
def reclist(abspath, recurse, ignore)
+ require 'puppet/file_serving'
+ require 'puppet/file_serving/fileset'
args = { :recurse => recurse, :links => :follow }
args[:ignore] = ignore if ignore
fs = Puppet::FileServing::Fileset.new(abspath, args)
@@ -720,9 +720,12 @@ class Puppet::Network::Handler
def list(relpath, recurse, ignore, client = nil)
result = []
valid_modules.each do |m|
- ary = reclist(mod_file_path(m, relpath, client), nil, recurse, ignore)
- ary = [] if ary.nil?
- result += ary
+ modpath = mod_file_path(m, relpath, client)
+ if FileTest.exists?(modpath)
+ ary = reclist(modpath, recurse, ignore)
+ ary = [] if ary.nil?
+ result += ary
+ end
end
result
end
diff --git a/spec/unit/network/handler/fileserver.rb b/spec/unit/network/handler/fileserver.rb
index e548cba..cce00d3 100644
--- a/spec/unit/network/handler/fileserver.rb
+++ b/spec/unit/network/handler/fileserver.rb
@@ -126,6 +126,44 @@ describe Puppet::Network::Handler::FileServer do
list.sort.should == [ ["/aFile", "file"], ["/", "directory"] ].sort
end
+ describe Puppet::Network::Handler::FileServer::PluginMount do
+ PLUGINS = Puppet::Network::Handler::FileServer::PLUGINS
+
+ # create a module plugin hierarchy
+ def create_plugin(mod, plugin)
+ dirname = File.join(@basedir, mod)
+ Dir.mkdir(dirname)
+ plugins = File.join(dirname, PLUGINS)
+ Dir.mkdir(plugins)
+ facter = File.join(plugins, plugin)
+ Dir.mkdir(facter)
+ create_file(File.join(facter,"fact.rb"))
+ end
+
+ before :each do
+ @modules = ["one","two"]
+ Puppet::Module.stubs(:all).returns(@modules.collect{ |p| File.join(@basedir,p)} )
+ @modules.each { |m| create_plugin(m, "facter") }
+
+ @modules.each do |p|
+ File.stubs(:directory?).with(File.join(@basedir,p,PLUGINS)).returns(true)
+ end
+
+ @mount = Puppet::Network::Handler::FileServer::PluginMount.new(PLUGINS)
+ @mount.allow("*")
+ end
+
+ it "should return a merged view of all plugins for all modules" do
+ list = @mount.list("facter",true,false)
+ list.should == [["/", "directory"], ["/fact.rb", "file"], ["/", "directory"], ["/fact.rb", "file"]]
+ end
+
+ it "should not fail for inexistant plugins type" do
+ lambda { @mount.list("puppet/parser",true,false) }.should_not raise_error
+ end
+
+ end
+
after do
FileUtils.rm_rf(@basedir)
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list