Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-10289

Route HttpPool.connection through http client

    XMLWordPrintable

Details

    • Task
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • PUP 6.16.0
    • None
    • Coremunity
    • Platform Core KANBAN
    • Deprecation
    • Calls to Puppet::Network::HttpPool (http_instance, http_ssl_instance, connection) are routed to the new HTTP client, but preserve the existing behavior for that API. The HttpPool class will be deprecated in a future 6.y release and removed in Puppet 7.
    • Needs Assessment

    Description

      Puppet::Network::HttpPool.connection, and deprecated methods http_instance and http_ssl_instance, currently return an instance of Puppet::Network::HTTP::Connection which is the legacy way of handling network connections.

      For this issue, have the connection, etc methods return an adapter that implements the Connection API, but routes the requests through the HTTP client. This should only happen if the http_client_class is not overridden (ie in puppetserver). The adapter should return and raise the same way as the Connection class does. To access these, "unwrap" the response and exception using Puppet::HTTP::Response#nethttp and Puppet::HTTP::HTTPError#cause, respectively.

      When running in puppetserver, the Puppet::Network::HttpPool.http_client_class will be non-nil, and in that case we should continue returning instances of that class when connection, etc are called.

      For this ticket, implement the public methods from Puppet::Network::HTTP::Connection on the adapter:

      get
      post
      head
      delete
      put
      request_get
      request_head
      request_post
      address
      port
      use_ssl?
      

      The request_XXX methods accept a code block and yield the response to it.

      Diagram for Puppet::Network::HTTP::ConnectionAdapter

      Source

      As a result of this work, it should be possible to use the http report process or puppetdb terminus when running puppet apply and have those requests routed through our http client instead of the deprecated Puppet::Network::HTTP::Connection code.

      Attachments

        Issue Links

          Activity

            People

              josh Josh Cooper
              josh Josh Cooper
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support