diff options
-rw-r--r-- | CHANGELOG | 2 | ||||
-rwxr-xr-x | lib/puppet/network/handler/fileserver.rb | 6 | ||||
-rw-r--r-- | spec/unit/network/handler/fileserver.rb | 4 | ||||
-rwxr-xr-x | test/network/handler/fileserver.rb | 8 |
4 files changed, 16 insertions, 4 deletions
@@ -1,4 +1,6 @@ 0.24.x + Fixing #947 - pluginsync no longer fails poorly when no plugins exist + Fixing #1614 - Environments no longer have to be listed out Fixed #1628 - Changed node search to use certname rather than Facter hostname diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb index ff9b96f6c..da0a2befe 100755 --- a/lib/puppet/network/handler/fileserver.rb +++ b/lib/puppet/network/handler/fileserver.rb @@ -70,7 +70,9 @@ class Puppet::Network::Handler mount.debug("Describing %s for %s" % [url, client]) if client # use the mount to resolve the path for us. - metadata = Puppet::FileServing::Metadata.new(url, :path => mount.file_path(path, client), :links => links) + return "" unless full_path = mount.file_path(path, client) + + metadata = Puppet::FileServing::Metadata.new(url, :path => full_path, :links => links) return "" unless metadata.exist? @@ -710,7 +712,7 @@ class Puppet::Network::Handler end def file_path(relpath, client = nil) - mod = valid_modules.map { |m| mod_path_exists?(m, relpath, client) ? m : nil }.compact.first + return nil unless mod = valid_modules.map { |m| mod_path_exists?(m, relpath, client) ? m : nil }.compact.first mod_file_path(mod, relpath, client) end diff --git a/spec/unit/network/handler/fileserver.rb b/spec/unit/network/handler/fileserver.rb index a9138f686..e548cba80 100644 --- a/spec/unit/network/handler/fileserver.rb +++ b/spec/unit/network/handler/fileserver.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' require 'puppet/network/handler/fileserver' -describe Puppet::Network::Handler do +describe Puppet::Network::Handler::FileServer do require 'tmpdir' def create_file(filename) @@ -130,4 +130,4 @@ describe Puppet::Network::Handler do FileUtils.rm_rf(@basedir) end -end
\ No newline at end of file +end diff --git a/test/network/handler/fileserver.rb b/test/network/handler/fileserver.rb index a705dbf4b..873657e5d 100755 --- a/test/network/handler/fileserver.rb +++ b/test/network/handler/fileserver.rb @@ -437,6 +437,14 @@ class TestFileServer < Test::Unit::TestCase assert_nil(retval, "Description of non-existent mounts returned a value") end + def test_describe_does_not_fail_when_mount_does_not_find_file + server = Puppet::Network::Handler.fileserver.new(:Local => true, :Config => false) + + assert_nothing_raised("Failed when describing missing plugins") do + server.describe "/plugins" + end + end + # test that our config file is parsing and working as planned def test_configfile server = nil |