[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:14:20 UTC 2011


The following commit has been merged in the experimental branch:
commit 9bc4bcefb1a9f2545b4828dcea7a41ef450e7d52
Author: Nick Lewis <nick at puppetlabs.com>
Date:   Wed Apr 13 18:46:55 2011 -0700

    (#7103) Fix HEAD requests in the HTTP handler
    
    HEAD request support was implemented in 2.6.x, and the internal API in the HTTP
    handler changed in 2.7.x. So when the branches were merged together, HEAD
    requests ended up using the wrong API without any visible merge conflicts or
    spec failures. This fixes them to use the correct API.
    
    Reviewed-By: Matt Robinson

diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb
index 2b9e81b..2c78a02 100644
--- a/lib/puppet/network/http/handler.rb
+++ b/lib/puppet/network/http/handler.rb
@@ -122,10 +122,10 @@ module Puppet::Network::HTTP::Handler
   end
 
   # Execute our head.
-  def do_head(indirection_request, request, response)
-    unless indirection_request.model.head(indirection_request.key, indirection_request.to_hash)
-      Puppet.info("Could not find #{indirection_request.indirection_name} for '#{indirection_request.key}'")
-      return do_exception(response, "Could not find #{indirection_request.indirection_name} #{indirection_request.key}", 404)
+  def do_head(indirection_name, key, params, request, response)
+    unless self.model(indirection_name).indirection.head(key, params)
+      Puppet.info("Could not find #{indirection_name} for '#{key}'")
+      return do_exception(response, "Could not find #{indirection_name} #{key}", 404)
     end
 
     # No need to set a response because no response is expected from a
diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb
index 83969c5..c709d82 100755
--- a/spec/unit/network/http/handler_spec.rb
+++ b/spec/unit/network/http/handler_spec.rb
@@ -240,34 +240,30 @@ describe Puppet::Network::HTTP::Handler do
 
     describe "when performing head operation" do
       before do
-        @irequest = stub 'indirection_request', :method => :head, :indirection_name => "my_handler", :to_hash => {}, :key => "my_result", :model => @model_class
+        @handler.stubs(:model).with("my_handler").returns(stub 'model', :indirection => @model_class)
+        @handler.stubs(:http_method).with(@request).returns("HEAD")
+        @handler.stubs(:path).with(@request).returns("/production/my_handler/my_result")
+        @handler.stubs(:params).with(@request).returns({})
 
         @model_class.stubs(:head).returns true
       end
 
-      it "should use the indirection request to find the model class" do
-        @irequest.expects(:model).returns @model_class
-
-        @handler.do_head(@irequest, @request, @response)
-      end
-
       it "should use the escaped request key" do
         @model_class.expects(:head).with do |key, args|
           key == "my_result"
         end.returns true
-        @handler.do_head(@irequest, @request, @response)
+        @handler.process(@request, @response)
       end
 
       it "should not generate a response when a model head call succeeds" do
         @handler.expects(:set_response).never
-        @handler.do_head(@irequest, @request, @response)
+        @handler.process(@request, @response)
       end
 
       it "should return a 404 when the model head call returns false" do
-        @model_class.stubs(:name).returns "my name"
         @handler.expects(:set_response).with { |response, body, status| status == 404 }
         @model_class.stubs(:head).returns(false)
-        @handler.do_head(@irequest, @request, @response)
+        @handler.process(@request, @response)
       end
     end
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list