[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:31:52 UTC 2010


The following commit has been merged in the upstream branch:
commit 8f9fc30bb3b992322a553aa7dc0c504af5e44250
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Tue Mar 30 16:33:44 2010 -0700

    REST FileBucket: REST barfs on relative paths
    
    Force FileBucket to always send absolute (real) paths

diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb
index 09aaf2b..ed67009 100644
--- a/lib/puppet/application/filebucket.rb
+++ b/lib/puppet/application/filebucket.rb
@@ -72,7 +72,6 @@ Puppet::Application.new(:filebucket) do
                 path = options[:bucket] || Puppet[:bucketdir]
                 @client = Puppet::FileBucket::Dipper.new(:Path => path)
             else
-                require 'puppet/network/handler'
                 @client = Puppet::FileBucket::Dipper.new(:Server => Puppet[:server])
             end
         rescue => detail
diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb
index b13e590..b4a9eb8 100644
--- a/lib/puppet/file_bucket/dipper.rb
+++ b/lib/puppet/file_bucket/dipper.rb
@@ -35,7 +35,7 @@ class Puppet::FileBucket::Dipper
         end
         contents = ::File.read(file)
         begin
-            file_bucket_file = Puppet::FileBucket::File.new(contents, :bucket_path => @local_path, :path => file)
+            file_bucket_file = Puppet::FileBucket::File.new(contents, :bucket_path => @local_path, :path => absolutize_path(file) )
             dest_path = "#{@rest_path}#{file_bucket_file.name}"
 
             file_bucket_file.save(dest_path)
@@ -91,5 +91,12 @@ class Puppet::FileBucket::Dipper
             return nil
         end
     end
+
+    private
+    def absolutize_path( path )
+        require 'pathname'
+        Pathname.new(path).realpath
+    end
+
 end
 
diff --git a/spec/unit/file_bucket/dipper.rb b/spec/unit/file_bucket/dipper.rb
index 5d66251..5ada34e 100755
--- a/spec/unit/file_bucket/dipper.rb
+++ b/spec/unit/file_bucket/dipper.rb
@@ -4,6 +4,12 @@ require File.dirname(__FILE__) + '/../../spec_helper'
 
 require 'puppet/file_bucket/dipper'
 describe Puppet::FileBucket::Dipper do
+    before do
+        ['/my/file'].each do |x|
+            Puppet::FileBucket::Dipper.any_instance.stubs(:absolutize_path).with(x).returns(x)
+        end
+    end
+
     it "should fail in an informative way when there are failures backing up to the server" do
         File.stubs(:exist?).returns true
         File.stubs(:read).returns "content"

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list