Jira (PUP-10730) Old report processors don't work with the new puppetserver http client

18 views
Skip to first unread message

Josh Cooper (Jira)

unread,
Oct 28, 2020, 2:35:03 PM10/28/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Puppet / Bug PUP-10730
Old report processors don't work with the new puppetserver http client
Change By: Josh Cooper
Team: Coremunity
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Oct 28, 2020, 2:35:04 PM10/28/20
to puppe...@googlegroups.com
Josh Cooper created an issue
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2020/10/28 11:34 AM
Fix Versions: PUP 7.0.0
Priority: Normal Normal
Reporter: Josh Cooper

Add the following report processor to lib/puppet/reports/legacy.rb, which is a simplified version of the http processor from puppet 5/6:

require 'puppet'
require 'puppet/network/http_pool'
require 'uri'
 
Puppet::Reports.register_report(:legacy) do
  def process
    url = URI.parse(Puppet[:reporturl])
    conn = Puppet::Network::HttpPool.http_instance(url.host, url.port, false)
    response = conn.post(url.path, self.to_yaml, { "Content-Type" => "application/x-yaml" })
    unless response.kind_of?(Net::HTTPSuccess)
      Puppet.err ("Unable to submit report to #{Puppet[:reporturl]} [#{response.code}] #{response.msg}")
    end
  end
end

Make sure puppetserver includes commit https://github.com/puppetlabs/puppetserver/commit/d6c07c9fae476cfd07502436fd397fa8ef60ac67 and the report processor is the jruby load-path.

Configure puppet.conf with:

[server]
reports = legacy
reporturl = http://localhost:8000/reports

Start a simple http server on port 8000, like python -m SimpleHTTPServer

Start puppetserver and run the agent, and the report processor will fail with:

020-10-28 11:26:04,868 ERROR [qtp470539277-446] [puppetserver] Puppet Report processor failed: undefined method `code' for nil:NilClass
/Users/josh/work/puppet/lib/puppet/reports/legacy.rb:35:in `process'
/Users/josh/work/puppet/lib/puppet/indirector/report/processor.rb:37:in `block in process'
/Users/josh/work/puppet/lib/puppet/indirector/report/processor.rb:54:in `block in processors'
org/jruby/RubyArray.java:1809:in `each'
/Users/josh/work/puppet/lib/puppet/indirector/report/processor.rb:51:in `processors'
/Users/josh/work/puppet/lib/puppet/indirector/report/processor.rb:30:in `process'
/Users/josh/work/puppet/lib/puppet/indirector/report/processor.rb:14:in `save'

This is because Puppet::HTTP::Response#nethttp returns nil

Josh Cooper (Jira)

unread,
Oct 28, 2020, 4:15:02 PM10/28/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Oct 28, 2020, 4:15:03 PM10/28/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Oct 29, 2020, 12:02:07 PM10/29/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Oct 29, 2020, 7:27:03 PM10/29/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Oct 30, 2020, 7:51:03 PM10/30/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Oct 30, 2020, 7:52:03 PM10/30/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes: Not Needed
Release Notes Summary: This issue only existed during development builds during platform 7 development or oddball configurations using puppet-agent 6.18.0 with puppetserver 7, which is not supported.
Reply all
Reply to author
Forward
0 new messages