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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/chef.gemspec +1 -1
- data/distro/ruby_bin_folder/msvcp140.dll +0 -0
- data/distro/ruby_bin_folder/vcruntime140.dll +0 -0
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/api_client/registration.rb +1 -1
- data/lib/chef/api_client_v1.rb +4 -4
- data/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +3 -3
- data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +2 -2
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +3 -3
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +4 -4
- data/lib/chef/client.rb +2 -2
- data/lib/chef/config_fetcher.rb +1 -1
- data/lib/chef/cookbook_uploader.rb +3 -3
- data/lib/chef/cookbook_version.rb +1 -1
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/environment.rb +1 -1
- data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +1 -1
- data/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +1 -1
- data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +1 -1
- data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +1 -1
- data/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +1 -1
- data/lib/chef/http.rb +3 -3
- data/lib/chef/key.rb +1 -1
- data/lib/chef/knife.rb +1 -1
- data/lib/chef/knife/bootstrap/client_builder.rb +1 -1
- data/lib/chef/knife/cookbook_delete.rb +1 -1
- data/lib/chef/knife/cookbook_upload.rb +1 -1
- data/lib/chef/knife/data_bag_create.rb +1 -1
- data/lib/chef/knife/raw.rb +1 -1
- data/lib/chef/knife/search.rb +1 -1
- data/lib/chef/knife/supermarket_share.rb +1 -1
- data/lib/chef/knife/supermarket_unshare.rb +1 -1
- data/lib/chef/mixin/api_version_request_handling.rb +1 -1
- data/lib/chef/monkey_patches/net_http.rb +5 -1
- data/lib/chef/node.rb +4 -4
- data/lib/chef/node/mixin/immutablize_array.rb +5 -0
- data/lib/chef/node/mixin/immutablize_hash.rb +3 -0
- data/lib/chef/org.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -1
- data/lib/chef/provider/apt_repository.rb +1 -1
- data/lib/chef/provider/group/windows.rb +1 -0
- data/lib/chef/provider/remote_file/content.rb +1 -1
- data/lib/chef/provider/windows_task.rb +2 -2
- data/lib/chef/resource/group.rb +4 -0
- data/lib/chef/resource/homebrew_cask.rb +8 -8
- data/lib/chef/resource/homebrew_tap.rb +6 -6
- data/lib/chef/resource/openssl_ec_private_key.rb +1 -1
- data/lib/chef/resource/openssl_x509_request.rb +1 -1
- data/lib/chef/resource/powershell_package_source.rb +11 -7
- data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
- data/lib/chef/resource/sysctl.rb +6 -6
- data/lib/chef/resource/timezone.rb +17 -1
- data/lib/chef/resource/windows_ad_join.rb +11 -1
- data/lib/chef/resource/windows_certificate.rb +7 -4
- data/lib/chef/resource/windows_printer.rb +3 -3
- data/lib/chef/resource/windows_task.rb +17 -8
- data/lib/chef/role.rb +1 -1
- data/lib/chef/run_list/run_list_expansion.rb +1 -1
- data/lib/chef/user.rb +1 -1
- data/lib/chef/user_v1.rb +4 -4
- data/lib/chef/util/windows/net_group.rb +6 -0
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api/net.rb +16 -0
- data/lib/chef/win32/net.rb +15 -0
- data/lib/chef/win32/version.rb +15 -15
- data/spec/functional/http/simple_spec.rb +10 -10
- data/spec/functional/resource/timezone_spec.rb +39 -0
- data/spec/functional/resource/windows_task_spec.rb +51 -7
- data/spec/integration/knife/client_create_spec.rb +1 -1
- data/spec/integration/knife/client_key_create_spec.rb +1 -1
- data/spec/integration/knife/cookbook_download_spec.rb +1 -1
- data/spec/integration/knife/cookbook_show_spec.rb +2 -2
- data/spec/integration/knife/data_bag_create_spec.rb +1 -1
- data/spec/integration/knife/environment_create_spec.rb +1 -1
- data/spec/integration/knife/node_create_spec.rb +1 -1
- data/spec/integration/knife/role_create_spec.rb +1 -1
- data/spec/support/shared/context/client.rb +1 -1
- data/spec/support/shared/unit/api_error_inspector.rb +5 -5
- data/spec/support/shared/unit/api_versioning.rb +2 -2
- data/spec/unit/api_client/registration_spec.rb +1 -1
- data/spec/unit/api_client_spec.rb +2 -2
- data/spec/unit/api_client_v1_spec.rb +3 -3
- data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +1 -1
- data/spec/unit/client_spec.rb +2 -2
- data/spec/unit/data_bag_item_spec.rb +1 -1
- data/spec/unit/data_bag_spec.rb +1 -1
- data/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb +4 -4
- data/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +2 -2
- data/spec/unit/knife/bootstrap/client_builder_spec.rb +1 -1
- data/spec/unit/knife/cookbook_delete_spec.rb +3 -3
- data/spec/unit/knife/data_bag_create_spec.rb +2 -2
- data/spec/unit/knife/supermarket_share_spec.rb +1 -1
- data/spec/unit/knife/supermarket_unshare_spec.rb +3 -3
- data/spec/unit/knife_spec.rb +7 -7
- data/spec/unit/mixin/api_version_request_handling_spec.rb +2 -2
- data/spec/unit/node_spec.rb +2 -2
- data/spec/unit/policy_builder/policyfile_spec.rb +2 -2
- data/spec/unit/provider/group/windows_spec.rb +15 -0
- data/spec/unit/provider/remote_file/content_spec.rb +2 -2
- data/spec/unit/resource/group_spec.rb +17 -0
- data/spec/unit/resource/powershell_package_source_spec.rb +2 -2
- data/spec/unit/resource/windows_certificate.rb +7 -0
- data/spec/unit/resource/windows_task_spec.rb +61 -20
- data/spec/unit/resource_reporter_spec.rb +7 -7
- data/spec/unit/user_v1_spec.rb +2 -2
- metadata +15 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98119483f2b582dd32ad2fceac40b9b091c0d16ec573d7d57f8d2b36e186cdaf
|
4
|
+
data.tar.gz: aa232f1d87949b67f4af917a6a53030a9e8203e0cff9c302f609cb8653e450e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 681c2c5e5c9bf2c0a9d4b65b2bc070bdc692ebde1dc5eb838992a375b9885b1a05b88c35ad7571f226cc102bf98fac4b8a1f25b32814a28a1b772963c1ec8dc3
|
7
|
+
data.tar.gz: 4a0c5eea5e3a2481a314672da5c734d745a124f8c1f666717dcacd2c06c95316deb270cc58ec022f03a7a5db4851bcc1af51d993a51000a89325e526cd156793
|
data/Gemfile
CHANGED
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", "
|
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"
|
Binary file
|
Binary file
|
data/lib/chef/api_client.rb
CHANGED
@@ -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::
|
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::
|
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"
|
data/lib/chef/api_client_v1.rb
CHANGED
@@ -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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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
|
data/lib/chef/config_fetcher.rb
CHANGED
@@ -39,7 +39,7 @@ class Chef
|
|
39
39
|
|
40
40
|
def fetch_remote_config
|
41
41
|
http.get("")
|
42
|
-
rescue SocketError, SystemCallError, Net::
|
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::
|
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::
|
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::
|
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::
|
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
data/lib/chef/data_bag_item.rb
CHANGED
data/lib/chef/environment.rb
CHANGED
@@ -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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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)
|