From 17205bb4e5d246f7a47b995826927a38b83fb3d0 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Mon, 20 Jul 2009 23:09:09 +0200 Subject: Fix #2424 - take 2, make sure default mounts allow every clients If there isn't any default mounts for plugins/modules, puppet auto creates them. The issue is that they don't have any authorization attached, so they default to deny all. Signed-off-by: Brice Figureau --- lib/puppet/file_serving/configuration.rb | 2 ++ spec/unit/file_serving/configuration.rb | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/puppet/file_serving/configuration.rb b/lib/puppet/file_serving/configuration.rb index 6f36d2750..3140455c7 100644 --- a/lib/puppet/file_serving/configuration.rb +++ b/lib/puppet/file_serving/configuration.rb @@ -96,7 +96,9 @@ class Puppet::FileServing::Configuration def mk_default_mounts @mounts["modules"] ||= Mount::Modules.new("modules") + @mounts["modules"].allow('*') @mounts["plugins"] ||= Mount::Plugins.new("plugins") + @mounts["plugins"].allow('*') end # Read the configuration file. diff --git a/spec/unit/file_serving/configuration.rb b/spec/unit/file_serving/configuration.rb index 9545f01cc..57ae83a14 100755 --- a/spec/unit/file_serving/configuration.rb +++ b/spec/unit/file_serving/configuration.rb @@ -102,6 +102,19 @@ describe Puppet::FileServing::Configuration do config.mounted?("plugins").should be_true end + it "should allow all access to modules and plugins if no fileserver.conf exists" do + FileTest.expects(:exists?).returns false # the file doesn't exist + modules = stub 'modules' + Puppet::FileServing::Mount::Modules.stubs(:new).returns(modules) + modules.expects(:allow).with('*') + + plugins = stub 'plugins' + Puppet::FileServing::Mount::Plugins.stubs(:new).returns(plugins) + plugins.expects(:allow).with('*') + + Puppet::FileServing::Configuration.create + end + it "should add modules and plugins mounts even if they are not returned by the parser" do @parser.expects(:parse).returns("one" => mock("mount")) FileTest.expects(:exists?).returns true # the file doesn't exist -- cgit