Jira (PUP-10324) Forward http client requests to puppetserver

31 views
Skip to first unread message

Josh Cooper (Jira)

unread,
Mar 2, 2020, 12:58:03 PM3/2/20
to puppe...@googlegroups.com
Josh Cooper created an issue
 
Puppet / Bug PUP-10324
Forward http client requests to puppetserver
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2020/03/02 9:57 AM
Priority: Normal Normal
Reporter: Josh Cooper

In order to switch the http report processor and other server-side termini to using the new HTTP Client API, we need to provide a puppetserver implementation of the API. However, we don't want to introduce an incompatibility in puppet 6.x such that it requires a specific version of puppetserver 6.x to work.

So the idea is to create an implementation of the HTTP Client API which adapts the legacy
Puppet::Network::HttpPool.http_client_class that puppetserver currently registers.

For this ticket:

1. Create Puppet::HTTP::ExternalClient which implements a subset of the Puppet::HTTP::Client API, get and post as those are the only methods implemented in puppetserver
2. All other public methods should raise NotImplementedError, like create_session, put, etc.
3. When get or post are called, the external client should create an instance of Puppet::Network::HttpPool.http_client_class and adapt the Client API to the legacy Connection API. So raise instances of Puppet::HTTP::HTTPError or subclasses, return Puppet::HTTP::Response objects, etc.
4. Register the Puppet::HTTP::ExternalClient in the puppet runtime when the HttpPool.http_client_class= method is called.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Mar 2, 2020, 12:59:03 PM3/2/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Coremunity Grooming

Josh Cooper (Jira)

unread,
Mar 2, 2020, 5:48:04 PM3/2/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
In order to switch the http report processor and other server-side termini to using the new HTTP Client API, we need to provide a puppetserver implementation of the API. However, we don't want to introduce an incompatibility in puppet 6.x such that it requires a specific version of puppetserver 6.x to work.

So the idea is to create an implementation of the HTTP Client API which adapts the legacy
{{Puppet::Network::HttpPool.http_client_class}} that puppetserver currently registers.

For this ticket:


1. Create {{Puppet::HTTP::ExternalClient}} which implements a subset of the {{Puppet::HTTP::Client}} API, {{ get }} and {{ post }}, as those are the only methods implemented in puppetserver .
2. All other public methods should raise {{NotImplementedError}}, like {{create_session}}, {{put}}, etc.

3. When {{get}} or {{post}} are called, the external client should create an instance of {{Puppet::Network::HttpPool.http_client_class}} and adapt the Client API to the legacy Connection API. So raise instances of {{Puppet::HTTP::HTTPError}} or subclasses, return {{Puppet::HTTP::Response}} objects, etc.
4. Register the {{Puppet::HTTP::ExternalClient}} in the puppet runtime when the {{HttpPool.http_client_class=}} method is called.

Josh Cooper (Jira)

unread,
Mar 2, 2020, 5:48:04 PM3/2/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 6.15.0

Josh Cooper (Jira)

unread,
Mar 4, 2020, 2:27:04 PM3/4/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Acceptance Criteria: It should be possible to write a custom function or report processor that makes POST and GET requests using the HTTP client when running in puppetserver. Add the following report processor to {{lib/puppet/reports/myreport.rb}}.

{code:ruby}
Puppet::Reports.register_report(:myreport) do
  def process
    client = Puppet.runtime['http']
client.get(URI("https://<puppetserver>.delivery.puppetlabs.net:8140/status/v1/simple"))
client.post(URI("https://<puppetserver>.delivery.puppetlabs.net:8140/puppet/v3/catalog/#{Puppet[:certname]}?environment=production"), content_type: 'text/plain', body: '')
    end
end
{code}

Register the processor in {{puppet.conf}}:

{code:ini}
[main]
reports = myreport
{code}

Run {{puppet agent -t}} and verify puppetserver successfully gets & posts.

Josh Cooper (Jira)

unread,
Mar 4, 2020, 2:27:04 PM3/4/20
to puppe...@googlegroups.com

Melissa Stone (Jira)

unread,
Mar 4, 2020, 4:19:03 PM3/4/20
to puppe...@googlegroups.com
Melissa Stone updated an issue
Change By: Melissa Stone
Sprint: Coremunity Grooming Platform Core KANBAN

Melissa Stone (Jira)

unread,
Mar 4, 2020, 4:19:04 PM3/4/20
to puppe...@googlegroups.com
Melissa Stone assigned an issue to Melissa Stone
Change By: Melissa Stone
Assignee: Melissa Stone

Melissa Stone (Jira)

unread,
Mar 4, 2020, 4:53:04 PM3/4/20
to puppe...@googlegroups.com
Melissa Stone updated an issue
Change By: Melissa Stone
Sprint: Platform Core KANBAN Coremunity Grooming

Melissa Stone (Jira)

unread,
Mar 4, 2020, 4:53:04 PM3/4/20
to puppe...@googlegroups.com
Melissa Stone assigned an issue to Unassigned
Change By: Melissa Stone
Assignee: Melissa Stone

Josh Cooper (Jira)

unread,
Mar 9, 2020, 9:15:04 PM3/9/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Coremunity Grooming Hopper

Josh Cooper (Jira)

unread,
Mar 11, 2020, 6:50:02 PM3/11/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Coremunity Hopper Platform Core KANBAN

Josh Cooper (Jira)

unread,
Mar 11, 2020, 6:50:04 PM3/11/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Platform Core KANBAN Coremunity Hopper

Josh Cooper (Jira)

unread,
Mar 13, 2020, 7:22:04 PM3/13/20
to puppe...@googlegroups.com
Josh Cooper assigned an issue to Josh Cooper
Change By: Josh Cooper
Assignee: Josh Cooper

Josh Cooper (Jira)

unread,
Mar 13, 2020, 7:39:03 PM3/13/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Coremunity Hopper Platform Core KANBAN

Melissa Stone (Jira)

unread,
Mar 26, 2020, 1:05:03 PM3/26/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Mar 26, 2020, 7:46:03 PM3/26/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes: Not Needed
Release Notes Summary: Calls to the new HTTP client will be routed to the existing puppetserver implementation. I put not needed because there shouldn't be any user visible change.

Josh Cooper (Jira)

unread,
Mar 30, 2020, 7:38:06 PM3/30/20
to puppe...@googlegroups.com

Claire Cadman (Jira)

unread,
Apr 27, 2020, 7:03:03 AM4/27/20
to puppe...@googlegroups.com
Claire Cadman updated an issue
 
Change By: Claire Cadman
Labels: doc_reviewed
Reply all
Reply to author
Forward
0 new messages