Details
-
Task
-
Status: Resolved
-
Normal
-
Resolution: Done
-
None
-
None
-
Froyo
-
Froyo 2020/10/26
-
Enhancement
-
Puppet Server now provides an HTTP client whose API conforms to the HTTP client provided by Puppet. This new client is stored in the Puppet runtime as `Puppet.runtime[:http]`.
-
Needs Assessment
Description
Currently Puppet Server implements a wrapper around the Apache AsyncHttp library (with help from the puppetlabs/clj-http-client library).
Coremmunity has reworked the http client in Puppet and the contract that extensions should implement (like there is one now).
We should create a new HttpClient in Puppet Server that implements the new interface and if the new interface is available we should configure Puppet with it.
Here are some notes from previous discussions:
I was thinking puppetserver could register its client (similar to the existing `Puppet::Server::HttpClient`) but with the following differences:
- A Puppet::Server::HttpClient object is created for a given server/port/use_ssl, and later the request path/query parameters/headers are passed to the get/post method. With the new API, the get/post methods receive the full URL.
- The existing Puppet::Server::HttpClient maps HTTP response codes back to Net::HTTP, but that's no longer necessary. Puppetserver can create a Puppet::HTTP::Response object directly with the status code, message, etc. and return that (or a subclass of it)
- The client can raise `Puppet::HTTP::HTTPError` or more specific subclasses if it wants instead of deriving from SocketError
Example implementation registration: https://gist.github.com/joshcooper/98344933dbd8c44d63acd9183e1481b3
Whoever picks this up should reach out to Josh Cooper for further details.