diff options
author | Thomas Heinen <theinen@tecracer.de> | 2022-07-11 16:01:50 +0200 |
---|---|---|
committer | PrajaktaPurohit <PrajaktaPurohit@users.noreply.github.com> | 2022-10-25 10:28:10 -0700 |
commit | 5fc5ac73d8a5eec7381da91efd38b431bda6c1bd (patch) | |
tree | c2f0332d28185edf9a7a2c5f47cedfab941f0605 | |
parent | d10d5aa0cffc0c7c2a3fd73e7abaa1335493735c (diff) | |
download | chef-5fc5ac73d8a5eec7381da91efd38b431bda6c1bd.tar.gz |
Fix missing require and small error in REST implementation
Signed-off-by: Thomas Heinen <theinen@tecracer.de>
-rw-r--r-- | lib/chef/resource/_rest_resource.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/chef/resource/_rest_resource.rb b/lib/chef/resource/_rest_resource.rb index f14e586eb2..8e72073b88 100644 --- a/lib/chef/resource/_rest_resource.rb +++ b/lib/chef/resource/_rest_resource.rb @@ -15,6 +15,7 @@ # limitations under the License. # +require "addressable/template" unless defined?(Addressable::Template) require "rest-client" unless defined?(RestClient) require "jmespath" unless defined?(JMESPath) require "chef/dsl/rest_resource" unless defined?(Chef::DSL::RestResource) @@ -221,7 +222,9 @@ action_class do response = rest_postprocess(response) first_only = current_resource.class.rest_api_document_first_element_only - first_only && response.is_a?(Array) ? response.first : response + response.data = response.data.first if first_only && response.data.is_a?(Array) + + response rescue RestClient::Exception => e rest_errorhandler(e) end |