Skip to content

Commit f3287fc

Browse files
author
Christopher Brown
committed
Merge branch 'total-integration' of git@github.com:skeptomai/chef into total-integration
2 parents 4b5d853 + d0d1aa6 commit f3287fc

4 files changed

Lines changed: 17 additions & 32 deletions

File tree

chef-solr/lib/chef/solr/application/rebuild.rb

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,6 @@ class Rebuild < Chef::Application
5454
:show_options => true,
5555
:exit => 0
5656

57-
option :nanite_identity,
58-
:long => "--nanite-identity ID",
59-
:description => "The nanite identity"
60-
61-
option :nanite_host,
62-
:long => "--nanite-host HOST",
63-
:description => "The nanite host"
64-
65-
option :nanite_port,
66-
:long => "--nanite-port PORT",
67-
:description => "The nanite port"
68-
69-
option :nanite_user,
70-
:long => "--nanite-user USER",
71-
:description => "The nanite user"
72-
73-
option :nanite_pass,
74-
:long => "--nanite-pass PASS",
75-
:description => "The nanite password"
76-
77-
option :nanite_vhost,
78-
:long => "--nanite-vhost VHOST",
79-
:description => "The nanite vhost"
80-
8157
option :couchdb_database,
8258
:short => "-d DB",
8359
:long => "--couchdb-database DB",

chef/lib/chef/rest.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ def run_request(method, url, headers={}, data=false, limit=10, raw=false)
179179
'Accept' => "application/json",
180180
})
181181
end
182+
183+
headers['X-Chef-Version'] = ::Chef::VERSION
182184

183185
if @cookies.has_key?("#{url.host}:#{url.port}")
184186
headers['Cookie'] = @cookies["#{url.host}:#{url.port}"]

chef/spec/unit/provider/deploy_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@
412412

413413
before do
414414
::File.stub!(:exist?).with("#{@expected_release_dir}/gems.yml").and_return(true)
415-
@gem_list = [{:name=>"ezmobius-nanite",:version=>"0.4.1.2"},{:name=>"eventmachine", :version=>"0.12.9"}]
415+
@gem_list = [{:name=>"eventmachine", :version=>"0.12.9"}]
416416
end
417417

418418
it "reads a gems.yml file, creating gem providers for each with action :upgrade" do
@@ -422,7 +422,7 @@
422422
gems = @provider.send(:gem_packages)
423423

424424
gems.map { |g| g.action }.should == [[:install], [:install]]
425-
gems.map { |g| g.name }.should == %w{ezmobius-nanite eventmachine}
425+
gems.map { |g| g.name }.should == %w{eventmachine}
426426
gems.map { |g| g.version }.should == %w{0.4.1.2 0.12.9}
427427
end
428428

chef/spec/unit/rest_spec.rb

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ def do_run_request(method=:GET, data=false, limit=10, raw=false)
165165
Net::HTTP.stub!(:new).and_return(@http_mock)
166166
@rest.run_request(method, @url_mock, {}, data, limit, raw)
167167
end
168+
169+
it "should always include the X-Chef-Version header" do
170+
Net::HTTP::Get.should_receive(:new).with("/?foo=bar",
171+
{ 'Accept' => 'application/json', 'X-Chef-Version' => Chef::VERSION }
172+
).and_return(@request_mock)
173+
do_run_request
174+
end
168175

169176
it "should raise an exception if the redirect limit is 0" do
170177
lambda { @rest.run_request(:GET, "/", {}, false, 0)}.should raise_error(ArgumentError)
@@ -269,36 +276,36 @@ def do_run_request(method=:GET, data=false, limit=10, raw=false)
269276
it "should set the cookie for this request if one exists for the given host:port" do
270277
@rest.cookies = { "#{@url_mock.host}:#{@url_mock.port}" => "cookie monster" }
271278
Net::HTTP::Get.should_receive(:new).with("/?foo=bar",
272-
{ 'Accept' => 'application/json', 'Cookie' => 'cookie monster' }
279+
{ 'Accept' => 'application/json', 'X-Chef-Version' => Chef::VERSION, 'Cookie' => 'cookie monster' }
273280
).and_return(@request_mock)
274281
do_run_request
275282
@rest.cookies = Hash.new
276283
end
277284

278285
it "should build a new HTTP GET request" do
279286
Net::HTTP::Get.should_receive(:new).with("/?foo=bar",
280-
{ 'Accept' => 'application/json' }
287+
{ 'Accept' => 'application/json', 'X-Chef-Version' => Chef::VERSION }
281288
).and_return(@request_mock)
282289
do_run_request
283290
end
284291

285292
it "should build a new HTTP POST request" do
286293
Net::HTTP::Post.should_receive(:new).with("/?foo=bar",
287-
{ 'Accept' => 'application/json', "Content-Type" => 'application/json' }
294+
{ 'Accept' => 'application/json', "Content-Type" => 'application/json', 'X-Chef-Version' => Chef::VERSION }
288295
).and_return(@request_mock)
289296
do_run_request(:POST, @data_mock)
290297
end
291298

292299
it "should build a new HTTP PUT request" do
293300
Net::HTTP::Put.should_receive(:new).with("/?foo=bar",
294-
{ 'Accept' => 'application/json', "Content-Type" => 'application/json' }
301+
{ 'Accept' => 'application/json', "Content-Type" => 'application/json', 'X-Chef-Version' => Chef::VERSION }
295302
).and_return(@request_mock)
296303
do_run_request(:PUT, @data_mock)
297304
end
298305

299306
it "should build a new HTTP DELETE request" do
300307
Net::HTTP::Delete.should_receive(:new).with("/?foo=bar",
301-
{ 'Accept' => 'application/json' }
308+
{ 'Accept' => 'application/json', 'X-Chef-Version' => Chef::VERSION }
302309
).and_return(@request_mock)
303310
do_run_request(:DELETE)
304311
end
@@ -360,7 +367,7 @@ def do_run_request(method=:GET, data=false, limit=10, raw=false)
360367
end
361368

362369
it "should build a new HTTP GET request without the application/json accept header for raw reqs" do
363-
Net::HTTP::Get.should_receive(:new).with("/?foo=bar", {}).and_return(@request_mock)
370+
Net::HTTP::Get.should_receive(:new).with("/?foo=bar", {'X-Chef-Version' => Chef::VERSION}).and_return(@request_mock)
364371
do_run_request(:GET, false, 10, true)
365372
end
366373

0 commit comments

Comments
 (0)