summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs/file_system
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-12-07 11:15:23 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2019-01-03 10:53:48 -0800
commit10db9b3a50eae9c4c966f39f5beca8f5c17d441e (patch)
tree596bb3da0bcd1e2fe9a24e3a376fd6223cb6156f /lib/chef/chef_fs/file_system
parent94ba9c022e57feb2949e22656d811a843b3410f1 (diff)
downloadchef-10db9b3a50eae9c4c966f39f5beca8f5c17d441e.tar.gz
change HTTPServerException to HTTPClientException for ruby 2.6
includes backcompat for 2.5 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/chef_fs/file_system')
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acl_entry.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policies_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb8
13 files changed, 23 insertions, 23 deletions
diff --git a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
index 3951f1a7e6..98091eaf9a 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
@@ -51,7 +51,7 @@ class Chef
rest.put("#{api_path}/#{permission}", { permission => acls[permission] })
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, e, "Timeout writing: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
else
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
index 9b0ea18cd8..a619dc75bf 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
@@ -108,7 +108,7 @@ class Chef
rest.delete(api_path)
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:delete, self, e, "Timeout deleting: #{e}")
- rescue Net::HTTPServerException
+ rescue Net::HTTPClientException
if $!.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
else
@@ -182,7 +182,7 @@ class Chef
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "Timeout reading: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "404"
@could_not_get_chef_object = e
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, @could_not_get_chef_object)
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb
index 6b4657ae6a..a680daacc0 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb
@@ -41,7 +41,7 @@ class Chef
File.open(tmpfile, "rb") { |f| f.read }
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "Timeout reading #{file[:url]}: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "#{e.message} retrieving #{file[:url]}")
rescue Errno::ENOENT
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
index e0eca5f6de..04d48d4e8e 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
@@ -60,7 +60,7 @@ class Chef
upload_cookbook(other, options)
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, e, "Timeout writing: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
case e.response.code
when "409"
raise Chef::ChefFS::FileSystem::CookbookFrozenError.new(:write, self, e, "Cookbook #{other.name} is frozen")
diff --git a/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb b/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
index ee0ecd3b40..0102ea2844 100644
--- a/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
@@ -56,7 +56,7 @@ class Chef
rest.delete(api_path)
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:delete, self, e, "Timeout deleting: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
else
diff --git a/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb b/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb
index 205aa9fd86..6c7dd7b477 100644
--- a/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb
@@ -33,7 +33,7 @@ class Chef
@children ||= root.get_json(api_path).keys.sort.map { |entry| make_child_entry(entry, true) }
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e, "Timeout getting children: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
else
@@ -50,7 +50,7 @@ class Chef
rest.post(api_path, { "name" => name })
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, "Timeout creating child '#{name}': #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "409"
raise Chef::ChefFS::FileSystem::AlreadyExistsError.new(:create_child, self, e, "Cannot create #{name} under #{path}: already exists")
else
diff --git a/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb b/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
index c81e880744..e56c68ffae 100644
--- a/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
@@ -33,7 +33,7 @@ class Chef
end
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e, "Timeout retrieving children: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if $!.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
else
diff --git a/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb b/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb
index 344a3deecc..02cde95880 100644
--- a/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb
@@ -46,7 +46,7 @@ class Chef
(desired_invites - invites).each do |invite|
begin
rest.post(api_path, { "user" => invite })
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "409"
Chef::Log.warn("Could not invite #{invite} to organization #{org}: #{api_error_text(e.response)}")
else
diff --git a/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb b/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
index a780ddd97b..a31922d7c8 100644
--- a/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
@@ -45,7 +45,7 @@ class Chef
(desired_members - members).each do |member|
begin
rest.post(api_path, "username" => member)
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if %w{404 405}.include?(e.response.code)
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."
else
diff --git a/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb b/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
index 8259db473d..df589a6cc0 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
@@ -80,7 +80,7 @@ class Chef
end
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e, "Timeout retrieving children: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
# 404 = NotFoundError
if $!.response.code == "404"
# GET /organizations/ORG/policies returned 404, but that just might be because
@@ -91,7 +91,7 @@ class Chef
root.get_json(parent.api_path)
# Return empty list if the organization exists but /policies didn't work
[]
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
end
@@ -131,7 +131,7 @@ class Chef
rest.post("#{api_path}/#{policy_name}/revisions", object)
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, "Timeout creating '#{name}': #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
# 404 = NotFoundError
if e.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
diff --git a/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb b/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
index df3d393d35..2a8ebd1f5a 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
@@ -79,7 +79,7 @@ class Chef
get_data = begin
rest.get(policy_path)
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
raise "Could not find policy '#{policy_name}'' with revision '#{policy_data["revision_id"]}'' on the server"
end
@@ -113,7 +113,7 @@ class Chef
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, "Timeout creating '#{name}': #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
# 404 = NotFoundError
if e.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
index 6ba53fab4b..a58a01ae8c 100644
--- a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
@@ -77,7 +77,7 @@ class Chef
end
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e, "Timeout retrieving children: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
# 404 = NotFoundError
if $!.response.code == "404"
@@ -90,7 +90,7 @@ class Chef
root.get_json(parent.api_path)
# Return empty list if the organization exists but /policies didn't work
[]
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
end
@@ -133,7 +133,7 @@ class Chef
rest.post(api_path, object)
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, "Timeout creating '#{name}': #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
# 404 = NotFoundError
if e.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
index 876ad7282b..9eaae9c73f 100644
--- a/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
@@ -72,7 +72,7 @@ class Chef
begin
@this_object_cache = rest.get(api_path)
@exists = true
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "404"
@exists = false
else
@@ -91,7 +91,7 @@ class Chef
rest.delete(api_path)
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:delete, self, e, "Timeout deleting: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
else
@@ -108,7 +108,7 @@ class Chef
@this_object_cache ? JSON.parse(@this_object_cache) : root.get_json(api_path)
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "Timeout reading: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if $!.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
else
@@ -185,7 +185,7 @@ class Chef
rest.put(api_path, object)
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, e, "Timeout writing: #{e}")
- rescue Net::HTTPServerException => e
+ rescue Net::HTTPClientException => e
if e.response.code == "404"
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)
else