diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2021-10-28 18:11:31 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2021-10-28 18:11:31 -0700 |
commit | a4a039733988aa51b69b68bd79986eb887da5cad (patch) | |
tree | 7f07a0a85504049e408595cc855582896205ab2c | |
parent | 0223a101605767d291545ff1f167a5148de6c063 (diff) | |
download | chef-a4a039733988aa51b69b68bd79986eb887da5cad.tar.gz |
Fix Net::HTTPServerException deprecations
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | knife/lib/chef/knife/org_user_add.rb | 2 | ||||
-rw-r--r-- | knife/lib/chef/knife/org_user_remove.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/package/habitat.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/knife/lib/chef/knife/org_user_add.rb b/knife/lib/chef/knife/org_user_add.rb index d1fb3a2a5d..82a90e0576 100644 --- a/knife/lib/chef/knife/org_user_add.rb +++ b/knife/lib/chef/knife/org_user_add.rb @@ -44,7 +44,7 @@ class Chef org = Chef::Org.new(@org_name) begin org.associate_user(@username) - rescue Net::HTTPServerException => e + rescue Net::HTTPClientException => e if e.response.code == "409" ui.msg "User #{username} already associated with organization #{org_name}" else diff --git a/knife/lib/chef/knife/org_user_remove.rb b/knife/lib/chef/knife/org_user_remove.rb index fc78f5767c..7d9322b5af 100644 --- a/knife/lib/chef/knife/org_user_remove.rb +++ b/knife/lib/chef/knife/org_user_remove.rb @@ -60,7 +60,7 @@ class Chef begin org.dissociate_user(@username) - rescue Net::HTTPServerException => e + rescue Net::HTTPClientException => e if e.response.code == "404" ui.msg "User #{username} is not associated with organization #{org_name}" exit 1 @@ -88,7 +88,7 @@ class Chef def remove_user_from_admin_group(org, org_name, username, admin_group_string) org.remove_user_from_group(admin_group_string, username) - rescue Net::HTTPServerException => e + rescue Net::HTTPClientException => e if e.response.code == "404" ui.warn <<~EOF User #{username} is not in the #{admin_group_string} group for organization #{org_name}. diff --git a/lib/chef/provider/package/habitat.rb b/lib/chef/provider/package/habitat.rb index 2b620d55c4..2b6d7668cf 100644 --- a/lib/chef/provider/package/habitat.rb +++ b/lib/chef/provider/package/habitat.rb @@ -108,7 +108,7 @@ class Chef headers["Authorization"] = "Bearer #{new_resource.auth_token}" if new_resource.auth_token Chef::JSONCompat.parse(http.get(url, headers)) - rescue Net::HTTPServerException + rescue Net::HTTPClientException nil end end |