+1. It might be nicer if full_path didn't return a leading slash, but this
definitely seems like the safest way to fix it.

On Wed, Jul 21, 2010 at 1:58 PM, Brice Figureau <
[email protected]> wrote:

> 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 <[email protected]>
> ---
>  lib/puppet/type/file/content.rb     |    2 +-
>  spec/unit/type/file/content_spec.rb |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/puppet/type/file/content.rb
> b/lib/puppet/type/file/content.rb
> index 74b380f..0d0bb55 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 e4b9f9b..a01a14a 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
>
> --
> 1.6.6.1
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<puppet-dev%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to