chef 14.8.12 → 14.9.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/chef.gemspec +1 -1
  4. data/lib/chef/api_client.rb +1 -1
  5. data/lib/chef/api_client/registration.rb +1 -1
  6. data/lib/chef/api_client_v1.rb +4 -4
  7. data/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +1 -1
  8. data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +2 -2
  9. data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +1 -1
  10. data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +1 -1
  11. data/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb +1 -1
  12. data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +2 -2
  13. data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +1 -1
  14. data/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb +1 -1
  15. data/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb +1 -1
  16. data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +3 -3
  17. data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +2 -2
  18. data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +3 -3
  19. data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +4 -4
  20. data/lib/chef/client.rb +2 -2
  21. data/lib/chef/config_fetcher.rb +1 -1
  22. data/lib/chef/cookbook_uploader.rb +3 -3
  23. data/lib/chef/cookbook_version.rb +1 -1
  24. data/lib/chef/data_bag.rb +1 -1
  25. data/lib/chef/data_bag_item.rb +1 -1
  26. data/lib/chef/environment.rb +1 -1
  27. data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +1 -1
  28. data/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +1 -1
  29. data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +1 -1
  30. data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +1 -1
  31. data/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +1 -1
  32. data/lib/chef/http.rb +3 -3
  33. data/lib/chef/key.rb +1 -1
  34. data/lib/chef/knife.rb +1 -1
  35. data/lib/chef/knife/bootstrap/client_builder.rb +1 -1
  36. data/lib/chef/knife/cookbook_delete.rb +1 -1
  37. data/lib/chef/knife/cookbook_upload.rb +1 -1
  38. data/lib/chef/knife/data_bag_create.rb +1 -1
  39. data/lib/chef/knife/raw.rb +1 -1
  40. data/lib/chef/knife/search.rb +1 -1
  41. data/lib/chef/knife/supermarket_share.rb +1 -1
  42. data/lib/chef/knife/supermarket_unshare.rb +1 -1
  43. data/lib/chef/mixin/api_version_request_handling.rb +1 -1
  44. data/lib/chef/monkey_patches/net_http.rb +5 -1
  45. data/lib/chef/node.rb +4 -4
  46. data/lib/chef/node/mixin/immutablize_array.rb +5 -0
  47. data/lib/chef/node/mixin/immutablize_hash.rb +3 -0
  48. data/lib/chef/org.rb +1 -1
  49. data/lib/chef/policy_builder/policyfile.rb +1 -1
  50. data/lib/chef/provider/apt_repository.rb +1 -1
  51. data/lib/chef/provider/group/windows.rb +1 -0
  52. data/lib/chef/provider/remote_file/content.rb +1 -1
  53. data/lib/chef/provider/windows_task.rb +2 -2
  54. data/lib/chef/resource/group.rb +4 -0
  55. data/lib/chef/resource/homebrew_cask.rb +8 -8
  56. data/lib/chef/resource/homebrew_tap.rb +6 -6
  57. data/lib/chef/resource/openssl_ec_private_key.rb +1 -1
  58. data/lib/chef/resource/openssl_x509_request.rb +1 -1
  59. data/lib/chef/resource/powershell_package_source.rb +11 -7
  60. data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
  61. data/lib/chef/resource/sysctl.rb +6 -6
  62. data/lib/chef/resource/timezone.rb +17 -1
  63. data/lib/chef/resource/windows_ad_join.rb +11 -1
  64. data/lib/chef/resource/windows_certificate.rb +7 -4
  65. data/lib/chef/resource/windows_printer.rb +3 -3
  66. data/lib/chef/resource/windows_task.rb +17 -8
  67. data/lib/chef/role.rb +1 -1
  68. data/lib/chef/run_list/run_list_expansion.rb +1 -1
  69. data/lib/chef/user.rb +1 -1
  70. data/lib/chef/user_v1.rb +4 -4
  71. data/lib/chef/util/windows/net_group.rb +6 -0
  72. data/lib/chef/version.rb +1 -1
  73. data/lib/chef/win32/api/net.rb +16 -0
  74. data/lib/chef/win32/net.rb +15 -0
  75. data/lib/chef/win32/version.rb +15 -15
  76. data/spec/functional/http/simple_spec.rb +10 -10
  77. data/spec/functional/resource/timezone_spec.rb +39 -0
  78. data/spec/functional/resource/windows_task_spec.rb +51 -7
  79. data/spec/integration/knife/client_create_spec.rb +1 -1
  80. data/spec/integration/knife/client_key_create_spec.rb +1 -1
  81. data/spec/integration/knife/cookbook_download_spec.rb +1 -1
  82. data/spec/integration/knife/cookbook_show_spec.rb +2 -2
  83. data/spec/integration/knife/data_bag_create_spec.rb +1 -1
  84. data/spec/integration/knife/environment_create_spec.rb +1 -1
  85. data/spec/integration/knife/node_create_spec.rb +1 -1
  86. data/spec/integration/knife/role_create_spec.rb +1 -1
  87. data/spec/support/shared/context/client.rb +1 -1
  88. data/spec/support/shared/unit/api_error_inspector.rb +5 -5
  89. data/spec/support/shared/unit/api_versioning.rb +2 -2
  90. data/spec/unit/api_client/registration_spec.rb +1 -1
  91. data/spec/unit/api_client_spec.rb +2 -2
  92. data/spec/unit/api_client_v1_spec.rb +3 -3
  93. data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +1 -1
  94. data/spec/unit/client_spec.rb +2 -2
  95. data/spec/unit/data_bag_item_spec.rb +1 -1
  96. data/spec/unit/data_bag_spec.rb +1 -1
  97. data/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb +4 -4
  98. data/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +2 -2
  99. data/spec/unit/knife/bootstrap/client_builder_spec.rb +1 -1
  100. data/spec/unit/knife/cookbook_delete_spec.rb +3 -3
  101. data/spec/unit/knife/data_bag_create_spec.rb +2 -2
  102. data/spec/unit/knife/supermarket_share_spec.rb +1 -1
  103. data/spec/unit/knife/supermarket_unshare_spec.rb +3 -3
  104. data/spec/unit/knife_spec.rb +7 -7
  105. data/spec/unit/mixin/api_version_request_handling_spec.rb +2 -2
  106. data/spec/unit/node_spec.rb +2 -2
  107. data/spec/unit/policy_builder/policyfile_spec.rb +2 -2
  108. data/spec/unit/provider/group/windows_spec.rb +15 -0
  109. data/spec/unit/provider/remote_file/content_spec.rb +2 -2
  110. data/spec/unit/resource/group_spec.rb +17 -0
  111. data/spec/unit/resource/powershell_package_source_spec.rb +2 -2
  112. data/spec/unit/resource/windows_certificate.rb +7 -0
  113. data/spec/unit/resource/windows_task_spec.rb +61 -20
  114. data/spec/unit/resource_reporter_spec.rb +7 -7
  115. data/spec/unit/user_v1_spec.rb +2 -2
  116. metadata +13 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c08486082bafcd0e272f4a8fbdcf7677de1260168607f2f1a8a1017d41654ba5
4
- data.tar.gz: 63d92a1beb97fef7ef40d566d02e2d6304848c51a0a59251dba9545bdbcdafcc
3
+ metadata.gz: 526794b697bdaa549867f4a0e1677105d853988a4aabe866304f886c9929ba3b
4
+ data.tar.gz: d5bebc413c998b69ea27a171946c02da841833404059a2a2c1ecd8c41bdbaaa1
5
5
  SHA512:
6
- metadata.gz: 123ec76435079d744bf4cd759b33932ea74f3381680b668a34e765f71817c69df7c2d012bbee5039363a26932b1cbda799d8a2abb85725fdbadceb4515f57f2b
7
- data.tar.gz: f8265387cc5daaf80506352219cf787a847d4250c121bde4162fb88b62606f04f9120100025bc1fdf7dd98673eae922068f80a81cf1b056fb09c745fb4acd232
6
+ metadata.gz: 6d55687d4035b05bc142d280aa45f3444003d5f231fcc5b587d757e0e096fe41f8ca6d6dccbb22f3bb91e0f18d1c3ba895609dfe31c1b35f5fe412350dcf602b
7
+ data.tar.gz: 2f05d0bb2ffd3a87b06a14c95c545f2767418e67904e8c06614e0750fb3898331995df8481d323530e521bc971ac66562b936c5455ea9fee0101a02ccfe09d48
data/Gemfile CHANGED
@@ -55,7 +55,7 @@ group(:development, :test) do
55
55
  gem "webmock"
56
56
 
57
57
  # for testing new chefstyle rules
58
- gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master"
58
+ gem "chefstyle", "=0.11.2"
59
59
  end
60
60
 
61
61
  group(:travis) do
data/chef.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency "mixlib-log", "~> 2.0", ">= 2.0.3"
22
22
  s.add_dependency "mixlib-authentication", "~> 2.1"
23
23
  s.add_dependency "mixlib-shellout", "~> 2.4"
24
- s.add_dependency "mixlib-archive", "~> 0.4"
24
+ s.add_dependency "mixlib-archive", ">= 0.4", "< 2.0"
25
25
  s.add_dependency "ohai", "~> 14.0"
26
26
 
27
27
  s.add_dependency "ffi", "~> 1.9", ">= 1.9.25"
@@ -186,7 +186,7 @@ class Chef
186
186
  # Save this client via the REST API, returns a hash including the private key
187
187
  def save
188
188
  http_api.put("clients/#{name}", { name: name, admin: admin, validator: validator })
189
- rescue Net::HTTPServerException => e
189
+ rescue Net::HTTPClientException => e
190
190
  # If that fails, go ahead and try and update it
191
191
  if e.response.code == "404"
192
192
  http_api.post("clients", { name: name, admin: admin, validator: validator })
@@ -93,7 +93,7 @@ class Chef
93
93
 
94
94
  def create_or_update
95
95
  create
96
- rescue Net::HTTPServerException => e
96
+ rescue Net::HTTPClientException => e
97
97
  # If create fails because the client exists, attempt to update. This
98
98
  # requires admin privileges.
99
99
  raise unless e.response.code == "409"
@@ -216,7 +216,7 @@ class Chef
216
216
  # Save this client via the REST API, returns a hash including the private key
217
217
  def save
218
218
  update
219
- rescue Net::HTTPServerException => e
219
+ rescue Net::HTTPClientException => e
220
220
  # If that fails, go ahead and try and update it
221
221
  if e.response.code == "404"
222
222
  create
@@ -235,7 +235,7 @@ class Chef
235
235
  private_key(reregistered_self.private_key)
236
236
  end
237
237
  self
238
- rescue Net::HTTPServerException => e
238
+ rescue Net::HTTPClientException => e
239
239
  # if there was a 406 related to versioning, give error explaining that
240
240
  # only API version 0 is supported for reregister command
241
241
  if e.response.code == "406" && e.response["x-ops-server-api-version"]
@@ -266,7 +266,7 @@ class Chef
266
266
 
267
267
  begin
268
268
  new_client = chef_rest_v1.put("clients/#{name}", payload)
269
- rescue Net::HTTPServerException => e
269
+ rescue Net::HTTPClientException => e
270
270
  # rescue API V0 if 406 and the server supports V0
271
271
  supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)
272
272
  raise e unless supported_versions && supported_versions.include?(0)
@@ -303,7 +303,7 @@ class Chef
303
303
  new_client.delete("chef_key")
304
304
  end
305
305
 
306
- rescue Net::HTTPServerException => e
306
+ rescue Net::HTTPClientException => e
307
307
  # rescue API V0 if 406 and the server supports V0
308
308
  supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)
309
309
  raise e unless supported_versions && supported_versions.include?(0)
@@ -51,7 +51,7 @@ class Chef
51
51
  rest.put("#{api_path}/#{permission}", { permission => acls[permission] })
52
52
  rescue Timeout::Error => e
53
53
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, e, "Timeout writing: #{e}")
54
- rescue Net::HTTPServerException => e
54
+ rescue Net::HTTPClientException => e
55
55
  if e.response.code == "404"
56
56
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
57
57
  else
@@ -108,7 +108,7 @@ class Chef
108
108
  rest.delete(api_path)
109
109
  rescue Timeout::Error => e
110
110
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:delete, self, e, "Timeout deleting: #{e}")
111
- rescue Net::HTTPServerException
111
+ rescue Net::HTTPClientException
112
112
  if $!.response.code == "404"
113
113
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
114
114
  else
@@ -182,7 +182,7 @@ class Chef
182
182
  rescue Timeout::Error => e
183
183
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "Timeout reading: #{e}")
184
184
 
185
- rescue Net::HTTPServerException => e
185
+ rescue Net::HTTPClientException => e
186
186
  if e.response.code == "404"
187
187
  @could_not_get_chef_object = e
188
188
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, @could_not_get_chef_object)
@@ -41,7 +41,7 @@ class Chef
41
41
  File.open(tmpfile, "rb") { |f| f.read }
42
42
  rescue Timeout::Error => e
43
43
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "Timeout reading #{file[:url]}: #{e}")
44
- rescue Net::HTTPServerException => e
44
+ rescue Net::HTTPClientException => e
45
45
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "#{e.message} retrieving #{file[:url]}")
46
46
  rescue Errno::ENOENT
47
47
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
@@ -60,7 +60,7 @@ class Chef
60
60
  upload_cookbook(other, options)
61
61
  rescue Timeout::Error => e
62
62
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, e, "Timeout writing: #{e}")
63
- rescue Net::HTTPServerException => e
63
+ rescue Net::HTTPClientException => e
64
64
  case e.response.code
65
65
  when "409"
66
66
  raise Chef::ChefFS::FileSystem::CookbookFrozenError.new(:write, self, e, "Cookbook #{other.name} is frozen")
@@ -56,7 +56,7 @@ class Chef
56
56
  rest.delete(api_path)
57
57
  rescue Timeout::Error => e
58
58
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:delete, self, e, "Timeout deleting: #{e}")
59
- rescue Net::HTTPServerException => e
59
+ rescue Net::HTTPClientException => e
60
60
  if e.response.code == "404"
61
61
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
62
62
  else
@@ -33,7 +33,7 @@ class Chef
33
33
  @children ||= root.get_json(api_path).keys.sort.map { |entry| make_child_entry(entry, true) }
34
34
  rescue Timeout::Error => e
35
35
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e, "Timeout getting children: #{e}")
36
- rescue Net::HTTPServerException => e
36
+ rescue Net::HTTPClientException => e
37
37
  if e.response.code == "404"
38
38
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
39
39
  else
@@ -50,7 +50,7 @@ class Chef
50
50
  rest.post(api_path, { "name" => name })
51
51
  rescue Timeout::Error => e
52
52
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, "Timeout creating child '#{name}': #{e}")
53
- rescue Net::HTTPServerException => e
53
+ rescue Net::HTTPClientException => e
54
54
  if e.response.code == "409"
55
55
  raise Chef::ChefFS::FileSystem::AlreadyExistsError.new(:create_child, self, e, "Cannot create #{name} under #{path}: already exists")
56
56
  else
@@ -33,7 +33,7 @@ class Chef
33
33
  end
34
34
  rescue Timeout::Error => e
35
35
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e, "Timeout retrieving children: #{e}")
36
- rescue Net::HTTPServerException => e
36
+ rescue Net::HTTPClientException => e
37
37
  if $!.response.code == "404"
38
38
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
39
39
  else
@@ -46,7 +46,7 @@ class Chef
46
46
  (desired_invites - invites).each do |invite|
47
47
  begin
48
48
  rest.post(api_path, { "user" => invite })
49
- rescue Net::HTTPServerException => e
49
+ rescue Net::HTTPClientException => e
50
50
  if e.response.code == "409"
51
51
  Chef::Log.warn("Could not invite #{invite} to organization #{org}: #{api_error_text(e.response)}")
52
52
  else
@@ -45,7 +45,7 @@ class Chef
45
45
  (desired_members - members).each do |member|
46
46
  begin
47
47
  rest.post(api_path, "username" => member)
48
- rescue Net::HTTPServerException => e
48
+ rescue Net::HTTPClientException => e
49
49
  if %w{404 405}.include?(e.response.code)
50
50
  raise "Chef server at #{api_path} does not allow you to directly add members. Please either upgrade your Chef server or move the users you want into invitations.json instead of members.json."
51
51
  else
@@ -80,7 +80,7 @@ class Chef
80
80
  end
81
81
  rescue Timeout::Error => e
82
82
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e, "Timeout retrieving children: #{e}")
83
- rescue Net::HTTPServerException => e
83
+ rescue Net::HTTPClientException => e
84
84
  # 404 = NotFoundError
85
85
  if $!.response.code == "404"
86
86
  # GET /organizations/ORG/policies returned 404, but that just might be because
@@ -91,7 +91,7 @@ class Chef
91
91
  root.get_json(parent.api_path)
92
92
  # Return empty list if the organization exists but /policies didn't work
93
93
  []
94
- rescue Net::HTTPServerException => e
94
+ rescue Net::HTTPClientException => e
95
95
  if e.response.code == "404"
96
96
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
97
97
  end
@@ -131,7 +131,7 @@ class Chef
131
131
  rest.post("#{api_path}/#{policy_name}/revisions", object)
132
132
  rescue Timeout::Error => e
133
133
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, "Timeout creating '#{name}': #{e}")
134
- rescue Net::HTTPServerException => e
134
+ rescue Net::HTTPClientException => e
135
135
  # 404 = NotFoundError
136
136
  if e.response.code == "404"
137
137
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
@@ -79,7 +79,7 @@ class Chef
79
79
 
80
80
  get_data = begin
81
81
  rest.get(policy_path)
82
- rescue Net::HTTPServerException => e
82
+ rescue Net::HTTPClientException => e
83
83
  raise "Could not find policy '#{policy_name}'' with revision '#{policy_data["revision_id"]}'' on the server"
84
84
  end
85
85
 
@@ -113,7 +113,7 @@ class Chef
113
113
 
114
114
  rescue Timeout::Error => e
115
115
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, "Timeout creating '#{name}': #{e}")
116
- rescue Net::HTTPServerException => e
116
+ rescue Net::HTTPClientException => e
117
117
  # 404 = NotFoundError
118
118
  if e.response.code == "404"
119
119
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
@@ -77,7 +77,7 @@ class Chef
77
77
  end
78
78
  rescue Timeout::Error => e
79
79
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e, "Timeout retrieving children: #{e}")
80
- rescue Net::HTTPServerException => e
80
+ rescue Net::HTTPClientException => e
81
81
  # 404 = NotFoundError
82
82
  if $!.response.code == "404"
83
83
 
@@ -90,7 +90,7 @@ class Chef
90
90
  root.get_json(parent.api_path)
91
91
  # Return empty list if the organization exists but /policies didn't work
92
92
  []
93
- rescue Net::HTTPServerException => e
93
+ rescue Net::HTTPClientException => e
94
94
  if e.response.code == "404"
95
95
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
96
96
  end
@@ -133,7 +133,7 @@ class Chef
133
133
  rest.post(api_path, object)
134
134
  rescue Timeout::Error => e
135
135
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, "Timeout creating '#{name}': #{e}")
136
- rescue Net::HTTPServerException => e
136
+ rescue Net::HTTPClientException => e
137
137
  # 404 = NotFoundError
138
138
  if e.response.code == "404"
139
139
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
@@ -72,7 +72,7 @@ class Chef
72
72
  begin
73
73
  @this_object_cache = rest.get(api_path)
74
74
  @exists = true
75
- rescue Net::HTTPServerException => e
75
+ rescue Net::HTTPClientException => e
76
76
  if e.response.code == "404"
77
77
  @exists = false
78
78
  else
@@ -91,7 +91,7 @@ class Chef
91
91
  rest.delete(api_path)
92
92
  rescue Timeout::Error => e
93
93
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:delete, self, e, "Timeout deleting: #{e}")
94
- rescue Net::HTTPServerException => e
94
+ rescue Net::HTTPClientException => e
95
95
  if e.response.code == "404"
96
96
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
97
97
  else
@@ -108,7 +108,7 @@ class Chef
108
108
  @this_object_cache ? JSON.parse(@this_object_cache) : root.get_json(api_path)
109
109
  rescue Timeout::Error => e
110
110
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "Timeout reading: #{e}")
111
- rescue Net::HTTPServerException => e
111
+ rescue Net::HTTPClientException => e
112
112
  if $!.response.code == "404"
113
113
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
114
114
  else
@@ -185,7 +185,7 @@ class Chef
185
185
  rest.put(api_path, object)
186
186
  rescue Timeout::Error => e
187
187
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, e, "Timeout writing: #{e}")
188
- rescue Net::HTTPServerException => e
188
+ rescue Net::HTTPClientException => e
189
189
  if e.response.code == "404"
190
190
  raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
191
191
  else
data/lib/chef/client.rb CHANGED
@@ -552,7 +552,7 @@ class Chef
552
552
  recipe = Chef::Recipe.new(nil, nil, run_context)
553
553
  recipe.from_file(required_recipe_file)
554
554
  run_context
555
- rescue Net::HTTPServerException => e
555
+ rescue Net::HTTPClientException => e
556
556
  case e.response
557
557
  when Net::HTTPNotFound
558
558
  logger.trace("Required Recipe not configured on the server, skipping it")
@@ -604,7 +604,7 @@ class Chef
604
604
  # @api private
605
605
  #
606
606
  def run_ohai
607
- filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version ohai_time os os_version} : nil
607
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version ohai_time os os_version init_package} : nil
608
608
  ohai.all_plugins(filter)
609
609
  events.ohai_completed(node)
610
610
  rescue Ohai::Exceptions::CriticalPluginFailure => e
@@ -39,7 +39,7 @@ class Chef
39
39
 
40
40
  def fetch_remote_config
41
41
  http.get("")
42
- rescue SocketError, SystemCallError, Net::HTTPServerException => error
42
+ rescue SocketError, SystemCallError, Net::HTTPClientException => error
43
43
  Chef::Application.fatal!("Cannot fetch config '#{config_location}': '#{error.class}: #{error.message}")
44
44
  end
45
45
 
@@ -84,7 +84,7 @@ class Chef
84
84
  retries = 0
85
85
  begin
86
86
  rest.put(sandbox_url, { is_completed: true })
87
- rescue Net::HTTPServerException => e
87
+ rescue Net::HTTPClientException => e
88
88
  if e.message =~ /^400/ && (retries += 1) <= 5
89
89
  sleep 2
90
90
  retry
@@ -101,7 +101,7 @@ class Chef
101
101
  save_url = opts[:force] ? manifest.force_save_url : manifest.save_url
102
102
  begin
103
103
  rest.put(save_url, manifest)
104
- rescue Net::HTTPServerException => e
104
+ rescue Net::HTTPClientException => e
105
105
  case e.response.code
106
106
  when "409"
107
107
  raise Chef::Exceptions::CookbookFrozen, "Version #{cb.version} of cookbook #{cb.name} is frozen. Use --force to override."
@@ -128,7 +128,7 @@ class Chef
128
128
  begin
129
129
  rest.put(url, file_contents, headers)
130
130
  checksums_to_upload.delete(checksum)
131
- rescue Net::HTTPServerException, Net::HTTPFatalError, Errno::ECONNREFUSED, Timeout::Error, Errno::ETIMEDOUT, SocketError => e
131
+ rescue Net::HTTPClientException, Net::HTTPFatalError, Errno::ECONNREFUSED, Timeout::Error, Errno::ETIMEDOUT, SocketError => e
132
132
  error_message = "Failed to upload #{file} (#{checksum}) to #{url} : #{e.message}"
133
133
  error_message << "\n#{e.response.body}" if e.respond_to?(:response)
134
134
  Chef::Knife.ui.error(error_message)
@@ -491,7 +491,7 @@ class Chef
491
491
  chef_server_rest.get("cookbooks/#{cookbook_name}")[cookbook_name]["versions"].map do |cb|
492
492
  cb["version"]
493
493
  end
494
- rescue Net::HTTPServerException => e
494
+ rescue Net::HTTPClientException => e
495
495
  if e.to_s =~ /^404/
496
496
  Chef::Log.error("Cannot find a cookbook named #{cookbook_name}")
497
497
  nil
data/lib/chef/data_bag.rb CHANGED
@@ -153,7 +153,7 @@ class Chef
153
153
  else
154
154
  create
155
155
  end
156
- rescue Net::HTTPServerException => e
156
+ rescue Net::HTTPClientException => e
157
157
  raise e unless e.response.code == "409"
158
158
  end
159
159
  self
@@ -168,7 +168,7 @@ class Chef
168
168
  else
169
169
  r.put("data/#{data_bag}/#{item_id}", self)
170
170
  end
171
- rescue Net::HTTPServerException => e
171
+ rescue Net::HTTPClientException => e
172
172
  raise e unless e.response.code == "404"
173
173
  r.post("data/#{data_bag}", self)
174
174
  end
@@ -275,7 +275,7 @@ class Chef
275
275
  def save
276
276
  begin
277
277
  chef_server_rest.put("environments/#{@name}", self)
278
- rescue Net::HTTPServerException => e
278
+ rescue Net::HTTPClientException => e
279
279
  raise e unless e.response.code == "404"
280
280
  chef_server_rest.post("environments", self)
281
281
  end
@@ -35,7 +35,7 @@ class Chef
35
35
 
36
36
  def add_explanation(error_description)
37
37
  case exception
38
- when Net::HTTPServerException, Net::HTTPFatalError
38
+ when Net::HTTPClientException, Net::HTTPFatalError
39
39
  humanize_http_exception(error_description)
40
40
  when EOFError
41
41
  describe_eof_error(error_description)
@@ -41,7 +41,7 @@ class Chef
41
41
 
42
42
  def add_explanation(error_description)
43
43
  case exception
44
- when Net::HTTPServerException, Net::HTTPFatalError
44
+ when Net::HTTPClientException, Net::HTTPFatalError
45
45
  humanize_http_exception(error_description)
46
46
  when EOFError
47
47
  describe_eof_error(error_description)
@@ -40,7 +40,7 @@ class Chef
40
40
 
41
41
  def add_explanation(error_description)
42
42
  case exception
43
- when Net::HTTPServerException, Net::HTTPFatalError
43
+ when Net::HTTPClientException, Net::HTTPFatalError
44
44
  humanize_http_exception(error_description)
45
45
  when Chef::Exceptions::PrivateKeyMissing
46
46
  error_description.section("Private Key Not Found:", <<~E)
@@ -23,7 +23,7 @@ class Chef
23
23
 
24
24
  def add_explanation(error_description)
25
25
  case exception
26
- when Net::HTTPServerException, Net::HTTPFatalError
26
+ when Net::HTTPClientException, Net::HTTPFatalError
27
27
  humanize_http_exception(error_description)
28
28
  when Errno::ECONNREFUSED, Timeout::Error, Errno::ETIMEDOUT, SocketError
29
29
  error_description.section("Network Error:", <<~E)
@@ -41,7 +41,7 @@ class Chef
41
41
 
42
42
  Your chef_server_url may be misconfigured, or the network could be down.
43
43
  E
44
- when Net::HTTPServerException, Net::HTTPFatalError
44
+ when Net::HTTPClientException, Net::HTTPFatalError
45
45
  humanize_http_exception(error_description)
46
46
  when Chef::Exceptions::MissingRole
47
47
  describe_missing_role(error_description)