diff options
-rw-r--r-- | NOTICE | 3 | ||||
-rw-r--r-- | chef-server/NOTICE | 10 | ||||
-rw-r--r-- | chef/NOTICE | 11 | ||||
-rw-r--r-- | chef/lib/chef/rest.rb | 3 | ||||
-rw-r--r-- | chef/spec/unit/rest_spec.rb | 9 |
5 files changed, 13 insertions, 23 deletions
@@ -10,7 +10,8 @@ Contributors and Copyright holders: * Copyright 2008, Bryan McLellan <btm@loftninjas.org> * Copyright 2008, Ezra Zygmuntowicz <ezra@engineyard.com> * Copyright 2009, Sean Cribbs <seancribbs@gmail.com> - + * Copyright 2009, Thom May <thom@clearairturbulence.org> + Chef incorporates code modified from Open4 (http://www.codeforpeople.com/lib/ruby/open4/), which was written by Ara T. Howard. Chef incorporates code modified from Merb (http://www.merbivore.com), which is Copyright (c) 2008 Engine Yard. diff --git a/chef-server/NOTICE b/chef-server/NOTICE deleted file mode 100644 index 02f03a496d..0000000000 --- a/chef-server/NOTICE +++ /dev/null @@ -1,10 +0,0 @@ -Chef NOTICE -=========== - -Developed at HJK Solutions (http://www.hjksolutions.com). - -Contributors and Copyright holders: - - * Copyright 2008, Adam Jacob <adam@opscode.com> - * Copyright 2008, Arjuna Christensen <aj@hjksolutions.com> - * Copyright 2008, Ezra Zygmuntowicz <ezra@engineyard.com> diff --git a/chef/NOTICE b/chef/NOTICE deleted file mode 100644 index 9c4af6e82d..0000000000 --- a/chef/NOTICE +++ /dev/null @@ -1,11 +0,0 @@ -Chef NOTICE -=========== - -Developed at HJK Solutions (http://www.hjksolutions.com). - -Contributors and Copyright holders: - - * Copyright 2008, Adam Jacob <adam@opscode.com> - * Copyright 2008, Arjuna Christensen <aj@hjksolutions.com> - * Copyright 2008, Ezra Zygmuntowicz <ezra@engineyard.com> -
\ No newline at end of file diff --git a/chef/lib/chef/rest.rb b/chef/lib/chef/rest.rb index 68ba9a3987..bdfa8a5e84 100644 --- a/chef/lib/chef/rest.rb +++ b/chef/lib/chef/rest.rb @@ -1,5 +1,6 @@ # # Author:: Adam Jacob (<adam@opscode.com>) +# Author:: Thom May (<thom@clearairturbulence.org>) # Copyright:: Copyright (c) 2008 Opscode, Inc. # License:: Apache License, Version 2.0 # @@ -217,7 +218,7 @@ class Chef res.body end end - elsif res.kind_of?(Net::HTTPFound) + elsif res.kind_of?(Net::HTTPFound) or res.kind_of?(Net::HTTPMovedPermanently) if res['set-cookie'] @cookies["#{url.host}:#{url.port}"] = res['set-cookie'] end diff --git a/chef/spec/unit/rest_spec.rb b/chef/spec/unit/rest_spec.rb index 525d17e148..8e789426ca 100644 --- a/chef/spec/unit/rest_spec.rb +++ b/chef/spec/unit/rest_spec.rb @@ -256,10 +256,19 @@ describe Chef::REST, "run_request method" do @http_response_mock.stub!(:[]).with('location').and_return(@url_mock.path) lambda { do_run_request(method=:GET, data=false, limit=1) }.should raise_error(ArgumentError) end + + it "should call run_request again on a Permanent Redirect response" do + @http_response_mock.stub!(:kind_of?).with(Net::HTTPSuccess).and_return(false) + @http_response_mock.stub!(:kind_of?).with(Net::HTTPFound).and_return(false) + @http_response_mock.stub!(:kind_of?).with(Net::HTTPMovedPermanently).and_return(true) + @http_response_mock.stub!(:[]).with('location').and_return(@url_mock.path) + lambda { do_run_request(method=:GET, data=false, limit=1) }.should raise_error(ArgumentError) + end it "should raise an exception on an unsuccessful request" do @http_response_mock.stub!(:kind_of?).with(Net::HTTPSuccess).and_return(false) @http_response_mock.stub!(:kind_of?).with(Net::HTTPFound).and_return(false) + @http_response_mock.stub!(:kind_of?).with(Net::HTTPMovedPermanently).and_return(false) @http_response_mock.should_receive(:error!) do_run_request end |