summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-03-24 16:44:44 -0700
committerNick Lewis <nick@puppetlabs.com>2011-03-24 16:44:44 -0700
commit0fec21fcd887685cf8421fdc309b878088f9fc48 (patch)
tree77745bbe6b91619d3255e4c517864b3a0f27b61f
parent0f3e537a127ff0a55e25e0eea4b7513529867df3 (diff)
parent7761acb5acd998d172b04adb8368a6a672fcde25 (diff)
downloadpuppet-0fec21fcd887685cf8421fdc309b878088f9fc48.tar.gz
puppet-0fec21fcd887685cf8421fdc309b878088f9fc48.tar.xz
puppet-0fec21fcd887685cf8421fdc309b878088f9fc48.zip
Merge branch 'ticket/2.6.next/5221' into 2.6.next
-rw-r--r--lib/puppet/file_serving/fileset.rb1
-rwxr-xr-xspec/unit/file_serving/fileset_spec.rb8
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/puppet/file_serving/fileset.rb b/lib/puppet/file_serving/fileset.rb
index fdbcf93a3..c020f036d 100644
--- a/lib/puppet/file_serving/fileset.rb
+++ b/lib/puppet/file_serving/fileset.rb
@@ -59,6 +59,7 @@ class Puppet::FileServing::Fileset
end
def initialize(path, options = {})
+ path = path.chomp(File::SEPARATOR)
raise ArgumentError.new("Fileset paths must be fully qualified") unless File.expand_path(path) == path
@path = path
diff --git a/spec/unit/file_serving/fileset_spec.rb b/spec/unit/file_serving/fileset_spec.rb
index ecc77812c..149c68c4a 100755
--- a/spec/unit/file_serving/fileset_spec.rb
+++ b/spec/unit/file_serving/fileset_spec.rb
@@ -13,6 +13,14 @@ describe Puppet::FileServing::Fileset, " when initializing" do
proc { Puppet::FileServing::Fileset.new("some/file") }.should raise_error(ArgumentError)
end
+ it "should not fail if the path is fully qualified, with a trailing separator" do
+ path = "/some/path/with/trailing/separator"
+ path_with_separator = "#{path}#{File::SEPARATOR}"
+ File.stubs(:lstat).with(path).returns stub('stat')
+ fileset = Puppet::FileServing::Fileset.new(path_with_separator)
+ fileset.path.should == path
+ end
+
it "should fail if its path does not exist" do
File.expects(:lstat).with("/some/file").returns nil
proc { Puppet::FileServing::Fileset.new("/some/file") }.should raise_error(ArgumentError)