summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2010-07-21 22:56:58 +0200
committerMarkus Roberts <Markus@reality.com>2010-07-25 22:24:42 -0700
commit03313b81c696d12c756a5ff5adced5bed162bbfc (patch)
tree365ee7a35c9c50e5f0fec9af277343e57aca7abe
parentac3a0d2d6c10f4a1616865d2c2e69b68a4bbcb3e (diff)
downloadpuppet-03313b81c696d12c756a5ff5adced5bed162bbfc.tar.gz
puppet-03313b81c696d12c756a5ff5adced5bed162bbfc.tar.xz
puppet-03313b81c696d12c756a5ff5adced5bed162bbfc.zip
Fix #4319 - source file url sent to the master is invalid
We were sending an incorrect (containing a //) url for sourced file content since the file streaming patches. Depending on the webserver in front of puppet it could fail (for instance nginx+mongrel). This patch fixes the offending // in each sourced file urls. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
-rwxr-xr-xlib/puppet/type/file/content.rb2
-rwxr-xr-xspec/unit/type/file/content_spec.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb
index 74b380f55..0d0bb5571 100755
--- a/lib/puppet/type/file/content.rb
+++ b/lib/puppet/type/file/content.rb
@@ -184,7 +184,7 @@ module Puppet
end
def chunk_file_from_source(source_or_content)
- request = Puppet::Indirector::Request.new(:file_content, :find, source_or_content.full_path)
+ request = Puppet::Indirector::Request.new(:file_content, :find, source_or_content.full_path.sub(/^\//,''))
connection = Puppet::Network::HttpPool.http_instance(source_or_content.server, source_or_content.port)
connection.request_get(indirection2uri(request), add_accept_encoding({"Accept" => "raw"})) do |response|
case response.code
diff --git a/spec/unit/type/file/content_spec.rb b/spec/unit/type/file/content_spec.rb
index e4b9f9bc6..a01a14a59 100755
--- a/spec/unit/type/file/content_spec.rb
+++ b/spec/unit/type/file/content_spec.rb
@@ -362,7 +362,7 @@ describe content do
end
it "should send the correct indirection uri" do
- @conn.expects(:request_get).with { |uri,headers| uri == "/production/file_content//path/to/source" }.yields(@response)
+ @conn.expects(:request_get).with { |uri,headers| uri == "/production/file_content/path/to/source" }.yields(@response)
@content.write(@fh)
end