]> git.openstreetmap.org Git - chef.git/commitdiff
Use ruby Net::HTTP in place of unmaintained httpclient
authorTom Hughes <tom@compton.nu>
Wed, 4 Dec 2024 22:58:28 +0000 (22:58 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 4 Dec 2024 23:00:23 +0000 (23:00 +0000)
cookbooks/wordpress/libraries/wordpress.rb
cookbooks/wordpress/metadata.rb

index 031e21ac057ffc9a8d4599fff66bb8d1530dfa40..73a0a5467b566e26fdd27d1593c5fd2d09d8875f 100644 (file)
@@ -1,13 +1,8 @@
-require "chef/mixin/shell_out"
-
-require "addressable"
-require "httpclient"
 require "json"
+require "net/http"
 
 class Chef
   module Wordpress
-    extend Chef::Mixin::ShellOut
-
     @api_responses = {}
 
     class << self
@@ -22,7 +17,7 @@ class Chef
       private
 
       def core_version_check
-        api_get("https://api.wordpress.org/core/version-check/1.7")
+        api_get("https://api.wordpress.org/core/version-check/1.7/")
       end
 
       def plugin_information(name)
@@ -30,9 +25,7 @@ class Chef
       end
 
       def api_get(url)
-        http_client = ::HTTPClient.new
-        http_client.ssl_config.set_default_paths # https://github.com/nahi/httpclient/issues/445
-        @api_responses[url] ||= ::JSON.parse(http_client.get_content(url))
+        @api_responses[url] ||= ::JSON.parse(Net::HTTP.get(URI(url)))
       end
     end
   end
index 09e29c13381b182fb734515e0556d893ad1f4e30..7898910cc44d1ce11453f035f2790a6a11dfe242 100644 (file)
@@ -14,4 +14,3 @@ depends           "git"
 depends           "mysql"
 depends           "php"
 depends           "ssl"
-gem               "httpclient"