[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Nick Lewis nick at puppetlabs.com
Tue May 10 08:19:25 UTC 2011


The following commit has been merged in the experimental branch:
commit 1f112cd61ff9e9a3b4a27314533ea4a91dcca76e
Author: Nick Lewis <nick at puppetlabs.com>
Date:   Tue May 3 16:18:57 2011 -0700

    (#7139) Accept '/' as a valid path in filesets
    
    This was unconditionally removing the trailing file separator ('/'), which is
    only valid when the file separator isn't the entire path. This fixes 'puppet
    resource file <path>'.
    
    Paired-With: Jacob Helwig

diff --git a/lib/puppet/file_serving/fileset.rb b/lib/puppet/file_serving/fileset.rb
index c020f03..f29f70a 100644
--- a/lib/puppet/file_serving/fileset.rb
+++ b/lib/puppet/file_serving/fileset.rb
@@ -59,7 +59,7 @@ class Puppet::FileServing::Fileset
   end
 
   def initialize(path, options = {})
-    path = path.chomp(File::SEPARATOR)
+    path = path.chomp(File::SEPARATOR) unless path == 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 a369ad3..4181065 100755
--- a/spec/unit/file_serving/fileset_spec.rb
+++ b/spec/unit/file_serving/fileset_spec.rb
@@ -20,6 +20,13 @@ describe Puppet::FileServing::Fileset, " when initializing" do
     fileset.path.should == path
   end
 
+  it "should not fail if the path is just the file separator" do
+    path = File::SEPARATOR
+    File.stubs(:lstat).with(path).returns stub('stat')
+    fileset = Puppet::FileServing::Fileset.new(path)
+    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)

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list