From a6ecf7e21f99521b8f3574914b3aa7f4784200e7 Mon Sep 17 00:00:00 2001 From: tahder Date: Thu, 19 Dec 2024 13:20:24 +1300 Subject: [PATCH] HTTParty will no longer override `response#nil?` Get rid off the DEPRECATED warning in related to that functionality.. ==> graylog: [DEPRECATION] HTTParty will no longer override `response#nil?`. This functionality will be removed in future versions. Please, add explicit check `response.body.nil? || response.body.empty?`. For more info refer to: https://github.com/jnunemaker/httparty/issues/568 ==> graylog: /tmp/vagrant-puppet/environments/local/local-modules/graylog_api/lib/puppet/provider/graylog_api.rb:109:in `request' ==> graylog: [DEPRECATION] HTTParty will no longer override `response#nil?`. This functionality will be removed in future versions. Please, add explicit check `response.body.nil? || response.body.empty?`. For more info refer to: https://github.com/jnunemaker/httparty/issues/568 --- lib/puppet/provider/graylog_api.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/graylog_api.rb b/lib/puppet/provider/graylog_api.rb index e81b957..57b4688 100644 --- a/lib/puppet/provider/graylog_api.rb +++ b/lib/puppet/provider/graylog_api.rb @@ -94,7 +94,7 @@ def request(method, path, params = {}) **tls_opts ) - if result.body + if result.body && !result.body.empty? if result.body.include? '"type":"ApiError"' Puppet.send_log(:err, "Got error response #{result.body}") raise @@ -106,7 +106,7 @@ def request(method, path, params = {}) Puppet.send_log(:err, "Got error response #{e.response}") raise e end - recursive_nil_to_undef(JSON.parse(result.body)) unless result.nil? + recursive_nil_to_undef(JSON.parse(result.body)) if result.body && !result.body.empty? end # Under Puppet Apply, undef in puppet-lang becomes :undef instead of nil