chef 14.8.12-universal-mingw32 → 14.9.13-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/chef.gemspec +1 -1
  4. data/distro/ruby_bin_folder/msvcp140.dll +0 -0
  5. data/distro/ruby_bin_folder/vcruntime140.dll +0 -0
  6. data/lib/chef/api_client.rb +1 -1
  7. data/lib/chef/api_client/registration.rb +1 -1
  8. data/lib/chef/api_client_v1.rb +4 -4
  9. data/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +1 -1
  10. data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +2 -2
  11. data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +1 -1
  12. data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +1 -1
  13. data/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb +1 -1
  14. data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +2 -2
  15. data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +1 -1
  16. data/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb +1 -1
  17. data/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb +1 -1
  18. data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +3 -3
  19. data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +2 -2
  20. data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +3 -3
  21. data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +4 -4
  22. data/lib/chef/client.rb +2 -2
  23. data/lib/chef/config_fetcher.rb +1 -1
  24. data/lib/chef/cookbook_uploader.rb +3 -3
  25. data/lib/chef/cookbook_version.rb +1 -1
  26. data/lib/chef/data_bag.rb +1 -1
  27. data/lib/chef/data_bag_item.rb +1 -1
  28. data/lib/chef/environment.rb +1 -1
  29. data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +1 -1
  30. data/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +1 -1
  31. data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +1 -1
  32. data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +1 -1
  33. data/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +1 -1
  34. data/lib/chef/http.rb +3 -3
  35. data/lib/chef/key.rb +1 -1
  36. data/lib/chef/knife.rb +1 -1
  37. data/lib/chef/knife/bootstrap/client_builder.rb +1 -1
  38. data/lib/chef/knife/cookbook_delete.rb +1 -1
  39. data/lib/chef/knife/cookbook_upload.rb +1 -1
  40. data/lib/chef/knife/data_bag_create.rb +1 -1
  41. data/lib/chef/knife/raw.rb +1 -1
  42. data/lib/chef/knife/search.rb +1 -1
  43. data/lib/chef/knife/supermarket_share.rb +1 -1
  44. data/lib/chef/knife/supermarket_unshare.rb +1 -1
  45. data/lib/chef/mixin/api_version_request_handling.rb +1 -1
  46. data/lib/chef/monkey_patches/net_http.rb +5 -1
  47. data/lib/chef/node.rb +4 -4
  48. data/lib/chef/node/mixin/immutablize_array.rb +5 -0
  49. data/lib/chef/node/mixin/immutablize_hash.rb +3 -0
  50. data/lib/chef/org.rb +1 -1
  51. data/lib/chef/policy_builder/policyfile.rb +1 -1
  52. data/lib/chef/provider/apt_repository.rb +1 -1
  53. data/lib/chef/provider/group/windows.rb +1 -0
  54. data/lib/chef/provider/remote_file/content.rb +1 -1
  55. data/lib/chef/provider/windows_task.rb +2 -2
  56. data/lib/chef/resource/group.rb +4 -0
  57. data/lib/chef/resource/homebrew_cask.rb +8 -8
  58. data/lib/chef/resource/homebrew_tap.rb +6 -6
  59. data/lib/chef/resource/openssl_ec_private_key.rb +1 -1
  60. data/lib/chef/resource/openssl_x509_request.rb +1 -1
  61. data/lib/chef/resource/powershell_package_source.rb +11 -7
  62. data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
  63. data/lib/chef/resource/sysctl.rb +6 -6
  64. data/lib/chef/resource/timezone.rb +17 -1
  65. data/lib/chef/resource/windows_ad_join.rb +11 -1
  66. data/lib/chef/resource/windows_certificate.rb +7 -4
  67. data/lib/chef/resource/windows_printer.rb +3 -3
  68. data/lib/chef/resource/windows_task.rb +17 -8
  69. data/lib/chef/role.rb +1 -1
  70. data/lib/chef/run_list/run_list_expansion.rb +1 -1
  71. data/lib/chef/user.rb +1 -1
  72. data/lib/chef/user_v1.rb +4 -4
  73. data/lib/chef/util/windows/net_group.rb +6 -0
  74. data/lib/chef/version.rb +1 -1
  75. data/lib/chef/win32/api/net.rb +16 -0
  76. data/lib/chef/win32/net.rb +15 -0
  77. data/lib/chef/win32/version.rb +15 -15
  78. data/spec/functional/http/simple_spec.rb +10 -10
  79. data/spec/functional/resource/timezone_spec.rb +39 -0
  80. data/spec/functional/resource/windows_task_spec.rb +51 -7
  81. data/spec/integration/knife/client_create_spec.rb +1 -1
  82. data/spec/integration/knife/client_key_create_spec.rb +1 -1
  83. data/spec/integration/knife/cookbook_download_spec.rb +1 -1
  84. data/spec/integration/knife/cookbook_show_spec.rb +2 -2
  85. data/spec/integration/knife/data_bag_create_spec.rb +1 -1
  86. data/spec/integration/knife/environment_create_spec.rb +1 -1
  87. data/spec/integration/knife/node_create_spec.rb +1 -1
  88. data/spec/integration/knife/role_create_spec.rb +1 -1
  89. data/spec/support/shared/context/client.rb +1 -1
  90. data/spec/support/shared/unit/api_error_inspector.rb +5 -5
  91. data/spec/support/shared/unit/api_versioning.rb +2 -2
  92. data/spec/unit/api_client/registration_spec.rb +1 -1
  93. data/spec/unit/api_client_spec.rb +2 -2
  94. data/spec/unit/api_client_v1_spec.rb +3 -3
  95. data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +1 -1
  96. data/spec/unit/client_spec.rb +2 -2
  97. data/spec/unit/data_bag_item_spec.rb +1 -1
  98. data/spec/unit/data_bag_spec.rb +1 -1
  99. data/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb +4 -4
  100. data/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +2 -2
  101. data/spec/unit/knife/bootstrap/client_builder_spec.rb +1 -1
  102. data/spec/unit/knife/cookbook_delete_spec.rb +3 -3
  103. data/spec/unit/knife/data_bag_create_spec.rb +2 -2
  104. data/spec/unit/knife/supermarket_share_spec.rb +1 -1
  105. data/spec/unit/knife/supermarket_unshare_spec.rb +3 -3
  106. data/spec/unit/knife_spec.rb +7 -7
  107. data/spec/unit/mixin/api_version_request_handling_spec.rb +2 -2
  108. data/spec/unit/node_spec.rb +2 -2
  109. data/spec/unit/policy_builder/policyfile_spec.rb +2 -2
  110. data/spec/unit/provider/group/windows_spec.rb +15 -0
  111. data/spec/unit/provider/remote_file/content_spec.rb +2 -2
  112. data/spec/unit/resource/group_spec.rb +17 -0
  113. data/spec/unit/resource/powershell_package_source_spec.rb +2 -2
  114. data/spec/unit/resource/windows_certificate.rb +7 -0
  115. data/spec/unit/resource/windows_task_spec.rb +61 -20
  116. data/spec/unit/resource_reporter_spec.rb +7 -7
  117. data/spec/unit/user_v1_spec.rb +2 -2
  118. metadata +15 -6
@@ -0,0 +1,39 @@
1
+ #
2
+ # Author:: Gary Bright (<digitalgaz@hotmail.com>)
3
+ # Copyright:: Copyright 2011-2016, Chef Software Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ require "spec_helper"
19
+
20
+ describe Chef::Resource::Timezone, :windows_only do
21
+ let(:timezone) { "GMT Standard Time" }
22
+
23
+ def timezone_resource
24
+ Chef::Resource::Timezone.new(timezone, run_context)
25
+ end
26
+
27
+ describe "when a timezone is provided on windows" do
28
+ it "should set a timezone" do
29
+ timezone_resource.run_action(:set)
30
+ end
31
+ end
32
+
33
+ describe "when a timezone is not provided on windows" do
34
+ let(:timezone) { nil }
35
+ it "raises an exception" do
36
+ expect { timezone_resource.run_action(:set) }.to raise_error(Chef::Exceptions::ValidationFailed)
37
+ end
38
+ end
39
+ end
@@ -1599,26 +1599,70 @@ describe Chef::Resource::WindowsTask, :windows_only do
1599
1599
  end
1600
1600
 
1601
1601
  context "when start_day is passed with frequency :onstart" do
1602
- it "not raises error" do
1602
+ it "does not raises error" do
1603
1603
  subject.frequency :onstart
1604
1604
  subject.start_day "09/20/2017"
1605
1605
  expect { subject.after_created }.not_to raise_error
1606
1606
  end
1607
1607
  end
1608
1608
 
1609
- context "when a non-system user is passed without password" do
1609
+ context "when a non system user is passed without password" do
1610
1610
  it "raises error" do
1611
- subject.user "Administrator"
1611
+ subject.user "USER"
1612
1612
  subject.frequency :onstart
1613
- expect { subject.after_created }.to raise_error(%q{Cannot specify a user other than the system users without specifying a password!. Valid passwordless users: 'SYSTEM', 'NT AUTHORITY\SYSTEM', 'LOCAL SERVICE', 'NT AUTHORITY\LOCAL SERVICE', 'NETWORK SERVICE', 'NT AUTHORITY\NETWORK SERVICE', 'ADMINISTRATORS', 'BUILTIN\ADMINISTRATORS', 'USERS', 'BUILTIN\USERS', 'GUESTS', 'BUILTIN\GUESTS'})
1613
+ expect { subject.after_created }.to raise_error(%q{Please provide a password or check if this task needs to be interactive! Valid passwordless users are: 'SYSTEM', 'NT AUTHORITY\SYSTEM', 'LOCAL SERVICE', 'NT AUTHORITY\LOCAL SERVICE', 'NETWORK SERVICE', 'NT AUTHORITY\NETWORK SERVICE', 'ADMINISTRATORS', 'BUILTIN\ADMINISTRATORS', 'USERS', 'BUILTIN\USERS', 'GUESTS', 'BUILTIN\GUESTS'})
1614
+ end
1615
+ it "does not raises error when task is interactive" do
1616
+ subject.user "USER"
1617
+ subject.frequency :onstart
1618
+ subject.interactive_enabled true
1619
+ expect { subject.after_created }.not_to raise_error
1614
1620
  end
1615
1621
  end
1616
1622
 
1617
- context "when interactive_enabled is passed for a System user without password" do
1618
- it "raises error" do
1623
+ context "when a system user is passed without password" do
1624
+ it "does not raises error" do
1625
+ subject.user "ADMINISTRATORS"
1626
+ subject.frequency :onstart
1627
+ expect { subject.after_created }.not_to raise_error
1628
+ end
1629
+ it "does not raises error when task is interactive" do
1630
+ subject.user "ADMINISTRATORS"
1631
+ subject.frequency :onstart
1632
+ subject.interactive_enabled true
1633
+ expect { subject.after_created }.not_to raise_error
1634
+ end
1635
+ end
1636
+
1637
+ context "when a non system user is passed with password" do
1638
+ it "does not raises error" do
1639
+ subject.user "USER"
1640
+ subject.password "XXXX"
1641
+ subject.frequency :onstart
1642
+ expect { subject.after_created }.not_to raise_error
1643
+ end
1644
+ it "does not raises error when task is interactive" do
1645
+ subject.user "USER"
1646
+ subject.password "XXXX"
1647
+ subject.frequency :onstart
1619
1648
  subject.interactive_enabled true
1649
+ expect { subject.after_created }.not_to raise_error
1650
+ end
1651
+ end
1652
+
1653
+ context "when a system user is passed with password" do
1654
+ it "raises error" do
1655
+ subject.user "ADMINISTRATORS"
1656
+ subject.password "XXXX"
1620
1657
  subject.frequency :onstart
1621
- expect { subject.after_created }.to raise_error("Please provide the password when attempting to set interactive/non-interactive.")
1658
+ expect { subject.after_created }.to raise_error("Password is not required for system users.")
1659
+ end
1660
+ it "raises error when task is interactive" do
1661
+ subject.user "ADMINISTRATORS"
1662
+ subject.password "XXXX"
1663
+ subject.frequency :onstart
1664
+ subject.interactive_enabled true
1665
+ expect { subject.after_created }.to raise_error("Password is not required for system users.")
1622
1666
  end
1623
1667
  end
1624
1668
 
@@ -44,7 +44,7 @@ EOM
44
44
  it "refuses to add an existing client" do
45
45
  pending "Knife client create must not blindly overwrite an existing client"
46
46
  knife("client create -k bah").should_succeed stderr: out
47
- expect { knife("client create -k bah") }.to raise_error(Net::HTTPServerException)
47
+ expect { knife("client create -k bah") }.to raise_error(Net::HTTPClientException)
48
48
  end
49
49
 
50
50
  it "saves the private key to a file" do
@@ -43,7 +43,7 @@ describe "knife client key create", :workstation do
43
43
 
44
44
  it "refuses to add an already existing key" do
45
45
  knife("client key create -k new bah")
46
- expect { knife("client key create -k new bah") }.to raise_error(Net::HTTPServerException)
46
+ expect { knife("client key create -k new bah") }.to raise_error(Net::HTTPClientException)
47
47
  end
48
48
 
49
49
  it "saves the private key to a file" do
@@ -49,7 +49,7 @@ EOM
49
49
  end
50
50
 
51
51
  it "knife cookbook download with an unknown version raises an error" do
52
- expect { knife("cookbook download -d #{tmpdir} x 1.0.0") }.to raise_error(Net::HTTPServerException)
52
+ expect { knife("cookbook download -d #{tmpdir} x 1.0.0") }.to raise_error(Net::HTTPClientException)
53
53
  end
54
54
  end
55
55
 
@@ -138,11 +138,11 @@ EOM
138
138
  end
139
139
 
140
140
  it "knife cookbook show with a non-existent version displays an error" do
141
- expect { knife("cookbook show x 1.0.1") }.to raise_error(Net::HTTPServerException)
141
+ expect { knife("cookbook show x 1.0.1") }.to raise_error(Net::HTTPClientException)
142
142
  end
143
143
 
144
144
  it "knife cookbook show with a non-existent cookbook displays an error" do
145
- expect { knife("cookbook show y") }.to raise_error(Net::HTTPServerException)
145
+ expect { knife("cookbook show y") }.to raise_error(Net::HTTPClientException)
146
146
  end
147
147
  end
148
148
  end
@@ -49,7 +49,7 @@ describe "knife data bag create", :workstation do
49
49
 
50
50
  it "fails to add an existing item" do
51
51
  knife("data bag create foo bar").should_succeed stdout: out, stderr: err
52
- expect { knife("data bag create foo bar") }.to raise_error(Net::HTTPServerException)
52
+ expect { knife("data bag create foo bar") }.to raise_error(Net::HTTPClientException)
53
53
  end
54
54
  end
55
55
  end
@@ -33,7 +33,7 @@ describe "knife environment create", :workstation do
33
33
  it "refuses to add an existing environment" do
34
34
  pending "Knife environment create must not blindly overwrite an existing environment"
35
35
  knife("environment create bah").should_succeed out
36
- expect { knife("environment create bah") }.to raise_error(Net::HTTPServerException)
36
+ expect { knife("environment create bah") }.to raise_error(Net::HTTPClientException)
37
37
  end
38
38
 
39
39
  end
@@ -39,7 +39,7 @@ describe "knife node create", :workstation do
39
39
  it "refuses to add an existing node" do
40
40
  pending "Knife node create must not blindly overwrite an existing node"
41
41
  knife("node create bah").should_succeed out
42
- expect { knife("node create bah") }.to raise_error(Net::HTTPServerException)
42
+ expect { knife("node create bah") }.to raise_error(Net::HTTPClientException)
43
43
  end
44
44
 
45
45
  end
@@ -33,7 +33,7 @@ describe "knife role create", :workstation do
33
33
  it "refuses to add an existing role" do
34
34
  pending "Knife role create must not blindly overwrite an existing role"
35
35
  knife("role create bah").should_succeed out
36
- expect { knife("role create bah") }.to raise_error(Net::HTTPServerException)
36
+ expect { knife("role create bah") }.to raise_error(Net::HTTPClientException)
37
37
  end
38
38
 
39
39
  end
@@ -142,7 +142,7 @@ shared_context "a client run" do
142
142
 
143
143
  def stub_for_required_recipe
144
144
  response = Net::HTTPNotFound.new("1.1", "404", "Not Found")
145
- exception = Net::HTTPServerException.new('404 "Not Found"', response)
145
+ exception = Net::HTTPClientException.new('404 "Not Found"', response)
146
146
  expect(http_node_load).to receive(:get).with("required_recipe").and_raise(exception)
147
147
  end
148
148
 
@@ -71,7 +71,7 @@ shared_examples_for "an api error inspector" do
71
71
  @response_body = "synchronize the clock on your host"
72
72
  @response = Net::HTTPUnauthorized.new("1.1", "401", "(response) unauthorized")
73
73
  allow(@response).to receive(:body).and_return(@response_body)
74
- @exception = Net::HTTPServerException.new("(exception) unauthorized", @response)
74
+ @exception = Net::HTTPClientException.new("(exception) unauthorized", @response)
75
75
  @inspector = described_class.new(@node_name, @exception, @config)
76
76
  @inspector.add_explanation(@description)
77
77
  end
@@ -87,7 +87,7 @@ shared_examples_for "an api error inspector" do
87
87
  @response_body = "check your key and node name"
88
88
  @response = Net::HTTPUnauthorized.new("1.1", "401", "(response) unauthorized")
89
89
  allow(@response).to receive(:body).and_return(@response_body)
90
- @exception = Net::HTTPServerException.new("(exception) unauthorized", @response)
90
+ @exception = Net::HTTPClientException.new("(exception) unauthorized", @response)
91
91
  @inspector = described_class.new(@node_name, @exception, @config)
92
92
  @inspector.add_explanation(@description)
93
93
  end
@@ -103,7 +103,7 @@ shared_examples_for "an api error inspector" do
103
103
  @response_body = "forbidden"
104
104
  @response = Net::HTTPForbidden.new("1.1", "403", "(response) forbidden")
105
105
  allow(@response).to receive(:body).and_return(@response_body)
106
- @exception = Net::HTTPServerException.new("(exception) forbidden", @response)
106
+ @exception = Net::HTTPClientException.new("(exception) forbidden", @response)
107
107
  @inspector = described_class.new(@node_name, @exception, @config)
108
108
  @inspector.add_explanation(@description)
109
109
  end
@@ -119,7 +119,7 @@ shared_examples_for "an api error inspector" do
119
119
  @response_body = "didn't like your data"
120
120
  @response = Net::HTTPBadRequest.new("1.1", "400", "(response) bad request")
121
121
  allow(@response).to receive(:body).and_return(@response_body)
122
- @exception = Net::HTTPServerException.new("(exception) bad request", @response)
122
+ @exception = Net::HTTPClientException.new("(exception) bad request", @response)
123
123
  @inspector = described_class.new(@node_name, @exception, @config)
124
124
  @inspector.add_explanation(@description)
125
125
  end
@@ -135,7 +135,7 @@ shared_examples_for "an api error inspector" do
135
135
  @response_body = "probably caused by a redirect to a get"
136
136
  @response = Net::HTTPNotFound.new("1.1", "404", "(response) not found")
137
137
  allow(@response).to receive(:body).and_return(@response_body)
138
- @exception = Net::HTTPServerException.new("(exception) not found", @response)
138
+ @exception = Net::HTTPClientException.new("(exception) not found", @response)
139
139
  @inspector = described_class.new(@node_name, @exception, @config)
140
140
  @inspector.add_explanation(@description)
141
141
  end
@@ -20,7 +20,7 @@ require "chef/exceptions"
20
20
 
21
21
  shared_examples_for "version handling" do
22
22
  let(:response_406) { OpenStruct.new(code: "406") }
23
- let(:exception_406) { Net::HTTPServerException.new("406 Not Acceptable", response_406) }
23
+ let(:exception_406) { Net::HTTPClientException.new("406 Not Acceptable", response_406) }
24
24
 
25
25
  before do
26
26
  allow(rest_v1).to receive(http_verb).and_raise(exception_406)
@@ -39,7 +39,7 @@ end # version handling
39
39
 
40
40
  shared_examples_for "user and client reregister" do
41
41
  let(:response_406) { OpenStruct.new(code: "406") }
42
- let(:exception_406) { Net::HTTPServerException.new("406 Not Acceptable", response_406) }
42
+ let(:exception_406) { Net::HTTPClientException.new("406 Not Acceptable", response_406) }
43
43
  let(:generic_exception) { Exception.new }
44
44
  let(:min_version) { "2" }
45
45
  let(:max_version) { "5" }
@@ -61,7 +61,7 @@ describe Chef::ApiClient::Registration do
61
61
  end
62
62
 
63
63
  let(:response_409) { Net::HTTPConflict.new("1.1", "409", "Conflict") }
64
- let(:exception_409) { Net::HTTPServerException.new("409 conflict", response_409) }
64
+ let(:exception_409) { Net::HTTPClientException.new("409 conflict", response_409) }
65
65
 
66
66
  let(:generated_private_key_pem) { IO.read(File.expand_path("ssl/private_key.pem", CHEF_SPEC_DATA)) }
67
67
  let(:generated_private_key) { OpenSSL::PKey::RSA.new(generated_private_key_pem) }
@@ -280,13 +280,13 @@ describe Chef::ApiClient do
280
280
  context "and the client does not exist on the server" do
281
281
  before do
282
282
  @a_404_response = Net::HTTPNotFound.new("404 not found and such", nil, nil)
283
- @a_404_exception = Net::HTTPServerException.new("404 not found exception", @a_404_response)
283
+ @a_404_exception = Net::HTTPClientException.new("404 not found exception", @a_404_response)
284
284
 
285
285
  expect(@http_client).to receive(:get).with("clients/lost-my-key").and_raise(@a_404_exception)
286
286
  end
287
287
 
288
288
  it "raises a 404 error" do
289
- expect { Chef::ApiClient.reregister("lost-my-key") }.to raise_error(Net::HTTPServerException)
289
+ expect { Chef::ApiClient.reregister("lost-my-key") }.to raise_error(Net::HTTPClientException)
290
290
  end
291
291
  end
292
292
 
@@ -312,20 +312,20 @@ describe Chef::ApiClientV1 do
312
312
  context "and the client does not exist on the server" do
313
313
  before do
314
314
  @a_404_response = Net::HTTPNotFound.new("404 not found and such", nil, nil)
315
- @a_404_exception = Net::HTTPServerException.new("404 not found exception", @a_404_response)
315
+ @a_404_exception = Net::HTTPClientException.new("404 not found exception", @a_404_response)
316
316
 
317
317
  expect(@http_client).to receive(:get).with("clients/lost-my-key").and_raise(@a_404_exception)
318
318
  end
319
319
 
320
320
  it "raises a 404 error" do
321
- expect { Chef::ApiClientV1.reregister("lost-my-key") }.to raise_error(Net::HTTPServerException)
321
+ expect { Chef::ApiClientV1.reregister("lost-my-key") }.to raise_error(Net::HTTPClientException)
322
322
  end
323
323
  end
324
324
  end
325
325
 
326
326
  describe "Versioned API Interactions" do
327
327
  let(:response_406) { OpenStruct.new(code: "406") }
328
- let(:exception_406) { Net::HTTPServerException.new("406 Not Acceptable", response_406) }
328
+ let(:exception_406) { Net::HTTPClientException.new("406 Not Acceptable", response_406) }
329
329
  let(:payload) do
330
330
  {
331
331
  name: "some_name",
@@ -29,7 +29,7 @@ describe Chef::ChefFS::FileSystem::OperationFailedError do
29
29
  response_body = '{"error":["Invalid key test in request body"]}'
30
30
  allow(@response).to receive(:code).and_return("400")
31
31
  allow(@response).to receive(:body).and_return(response_body)
32
- exception = Net::HTTPServerException.new("(exception) unauthorized", @response)
32
+ exception = Net::HTTPClientException.new("(exception) unauthorized", @response)
33
33
  expect do
34
34
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, exception), error_message
35
35
  end.to raise_error(Chef::ChefFS::FileSystem::OperationFailedError, "#{error_message} cause: #{response_body}")
@@ -38,7 +38,7 @@ describe Chef::Client do
38
38
  end
39
39
 
40
40
  it "runs ohai with only the minimum required plugins" do
41
- expected_filter = %w{fqdn machinename hostname platform platform_version ohai_time os os_version}
41
+ expected_filter = %w{fqdn machinename hostname platform platform_version ohai_time os os_version init_package}
42
42
  expect(ohai_system).to receive(:all_plugins).with(expected_filter)
43
43
  client.run_ohai
44
44
  end
@@ -441,7 +441,7 @@ EOM
441
441
 
442
442
  context "when required_recipe returns 404" do
443
443
  let(:http_response) { Net::HTTPNotFound.new("1.1", "404", "Not Found") }
444
- let(:http_exception) { Net::HTTPServerException.new('404 "Not Found"', http_response) }
444
+ let(:http_exception) { Net::HTTPClientException.new('404 "Not Found"', http_response) }
445
445
 
446
446
  before(:each) do
447
447
  expect(rest).to receive(:get).with("required_recipe").and_raise(http_exception)
@@ -298,7 +298,7 @@ describe Chef::DataBagItem do
298
298
 
299
299
  it "should create if the item is not found" do
300
300
  exception = double("404 error", code: "404")
301
- expect(server).to receive(:put).and_raise(Net::HTTPServerException.new("foo", exception))
301
+ expect(server).to receive(:put).and_raise(Net::HTTPClientException.new("foo", exception))
302
302
  expect(server).to receive(:post).with("data/books", data_bag_item)
303
303
  data_bag_item.save
304
304
  end
@@ -89,7 +89,7 @@ describe Chef::DataBag do
89
89
 
90
90
  it "should silently proceed when the data bag already exists" do
91
91
  exception = double("409 error", code: "409")
92
- expect(@rest).to receive(:post).and_raise(Net::HTTPServerException.new("foo", exception))
92
+ expect(@rest).to receive(:post).and_raise(Net::HTTPClientException.new("foo", exception))
93
93
  @data_bag.save
94
94
  end
95
95
 
@@ -35,7 +35,7 @@ describe Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector do
35
35
  @response_body = %q({"error": [{"message": "gtfo"}])
36
36
  @response = Net::HTTPForbidden.new("1.1", "403", "(response) forbidden")
37
37
  allow(@response).to receive(:body).and_return(@response_body)
38
- @exception = Net::HTTPServerException.new("(exception) forbidden", @response)
38
+ @exception = Net::HTTPClientException.new("(exception) forbidden", @response)
39
39
 
40
40
  @inspector = Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector.new(@expanded_run_list, @exception)
41
41
  @inspector.add_explanation(@description)
@@ -56,7 +56,7 @@ describe Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector do
56
56
  @response_body = "{\"error\":[\"{\\\"non_existent_cookbooks\\\":[\\\"apache2\\\"],\\\"cookbooks_with_no_versions\\\":[\\\"users\\\"],\\\"message\\\":\\\"Run list contains invalid items: no such cookbook nope.\\\"}\"]}"
57
57
  @response = Net::HTTPPreconditionFailed.new("1.1", "412", "(response) unauthorized")
58
58
  allow(@response).to receive(:body).and_return(@response_body)
59
- @exception = Net::HTTPServerException.new("(exception) precondition failed", @response)
59
+ @exception = Net::HTTPClientException.new("(exception) precondition failed", @response)
60
60
 
61
61
  @inspector = Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector.new(@expanded_run_list, @exception)
62
62
  @inspector.add_explanation(@description)
@@ -84,7 +84,7 @@ describe Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector do
84
84
  @response_body = "{\"error\":[{\"non_existent_cookbooks\":[],\"cookbooks_with_no_versions\":[],\"message\":\"unable to solve dependencies in alotted time.\"}]}"
85
85
  @response = Net::HTTPPreconditionFailed.new("1.1", "412", "(response) unauthorized")
86
86
  allow(@response).to receive(:body).and_return(@response_body)
87
- @exception = Net::HTTPServerException.new("(exception) precondition failed", @response)
87
+ @exception = Net::HTTPClientException.new("(exception) precondition failed", @response)
88
88
 
89
89
  @inspector = Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector.new(@expanded_run_list, @exception)
90
90
  @inspector.add_explanation(@description)
@@ -107,7 +107,7 @@ describe Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector do
107
107
  @response_body = "{\"error\":[{\"non_existent_cookbooks\":[\"apache2\"],\"cookbooks_with_no_versions\":[\"users\"],\"message\":\"Run list contains invalid items: no such cookbook nope.\"}]}"
108
108
  @response = Net::HTTPPreconditionFailed.new("1.1", "412", "(response) unauthorized")
109
109
  allow(@response).to receive(:body).and_return(@response_body)
110
- @exception = Net::HTTPServerException.new("(exception) precondition failed", @response)
110
+ @exception = Net::HTTPClientException.new("(exception) precondition failed", @response)
111
111
 
112
112
  @inspector = Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector.new(@expanded_run_list, @exception)
113
113
  @inspector.add_explanation(@description)
@@ -55,7 +55,7 @@ describe Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector do
55
55
  @response_body = "forbidden"
56
56
  @response = Net::HTTPForbidden.new("1.1", "403", "(response) forbidden")
57
57
  allow(@response).to receive(:body).and_return(@response_body)
58
- @exception = Net::HTTPServerException.new("(exception) forbidden", @response)
58
+ @exception = Net::HTTPClientException.new("(exception) forbidden", @response)
59
59
  @inspector = Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector.new(@node, @exception)
60
60
  allow(@inspector).to receive(:config).and_return(node_name: "unit-test.example.com")
61
61
 
@@ -73,7 +73,7 @@ describe Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector do
73
73
  @response_body = "check your key and node name"
74
74
  @response = Net::HTTPUnauthorized.new("1.1", "401", "(response) unauthorized")
75
75
  allow(@response).to receive(:body).and_return(@response_body)
76
- @exception = Net::HTTPServerException.new("(exception) unauthorized", @response)
76
+ @exception = Net::HTTPClientException.new("(exception) unauthorized", @response)
77
77
 
78
78
  @inspector = Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector.new(@node, @exception)
79
79
  allow(@inspector).to receive(:config).and_return(node_name: "unit-test.example.com",
@@ -42,7 +42,7 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
42
42
 
43
43
  context "#sanity_check!" do
44
44
  let(:response_404) { OpenStruct.new(code: "404") }
45
- let(:exception_404) { Net::HTTPServerException.new("404 not found", response_404) }
45
+ let(:exception_404) { Net::HTTPClientException.new("404 not found", response_404) }
46
46
 
47
47
  context "in cases where the prompting fails" do
48
48
  before do
@@ -139,15 +139,15 @@ describe Chef::Knife::CookbookDelete do
139
139
  end
140
140
 
141
141
  it "should raise if an error other than HTTP 404 is returned" do
142
- exception = Net::HTTPServerException.new("500 Internal Server Error", "500")
142
+ exception = Net::HTTPClientException.new("500 Internal Server Error", "500")
143
143
  expect(@rest_mock).to receive(:get).and_raise(exception)
144
- expect { @knife.available_versions }.to raise_error Net::HTTPServerException
144
+ expect { @knife.available_versions }.to raise_error Net::HTTPClientException
145
145
  end
146
146
 
147
147
  describe "if the cookbook can't be found" do
148
148
  before(:each) do
149
149
  expect(@rest_mock).to receive(:get)
150
- .and_raise(Net::HTTPServerException.new("404 Not Found", "404"))
150
+ .and_raise(Net::HTTPClientException.new("404 Not Found", "404"))
151
151
  end
152
152
 
153
153
  it "should print an error" do