diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-12-07 11:15:23 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-01-03 10:53:48 -0800 |
commit | 10db9b3a50eae9c4c966f39f5beca8f5c17d441e (patch) | |
tree | 596bb3da0bcd1e2fe9a24e3a376fd6223cb6156f /lib/chef/node.rb | |
parent | 94ba9c022e57feb2949e22656d811a843b3410f1 (diff) | |
download | chef-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/node.rb')
-rw-r--r-- | lib/chef/node.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/node.rb b/lib/chef/node.rb index c31fc99279..87418b5732 100644 --- a/lib/chef/node.rb +++ b/lib/chef/node.rb @@ -575,7 +575,7 @@ class Chef def self.find_or_create(node_name) load(node_name) - rescue Net::HTTPServerException => e + rescue Net::HTTPClientException => e raise unless e.response.code == "404" node = build(node_name) node.create @@ -608,7 +608,7 @@ class Chef else chef_server_rest.put("nodes/#{name}", data_for_save) end - rescue Net::HTTPServerException => e + rescue Net::HTTPClientException => e if e.response.code == "404" chef_server_rest.post("nodes", data_for_save) else @@ -622,7 +622,7 @@ class Chef def create chef_server_rest.post("nodes", data_for_save) self - rescue Net::HTTPServerException => e + rescue Net::HTTPClientException => e # Chef Server before 12.3 rejects node JSON with 'policy_name' or # 'policy_group' keys, but 'policy_name' will be detected first. # Backcompat can be removed in 13.0 @@ -655,7 +655,7 @@ class Chef trimmed_data = data_for_save_without_policyfile_attrs chef_server_rest.put("nodes/#{name}", trimmed_data) - rescue Net::HTTPServerException => e + rescue Net::HTTPClientException => e raise e unless e.response.code == "404" chef_server_rest.post("nodes", trimmed_data) end |