Project

General

Profile

Actions

Bug #3525

closed

foreman-report_v2 raises an exception: no block given

Added by Mark Heily over 10 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Puppet Reports
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When our Puppetmaster attempts to use the latest version of foreman-report_v2.rb.erb to send a report to Foreman 1.3, it generates this exception:

Oct 25 11:31:32 util-stage-001 puppet-master[19693]: Report processor failed: Could not send report to Foreman at https://foreman.foo.com//api/reports: no block given /usr/lib/ruby/site_ruby/1.8/puppet/util/autoload.rb:77:in `inject'/usr/lib/ruby/site_ruby/1.8/puppet/reports/foreman.rb:101:in `each'/usr/lib/ruby/site_ruby/1.8/puppet/reports/foreman.rb:101:in `inject'/usr/lib/ruby/site_ruby/1.8/puppet/reports/foreman.rb:101:in `metrics_to_hash'/usr/lib/ruby/site_ruby/1.8/puppet/reports/foreman.rb:72:in `generate_report'/usr/lib/ruby/site_ruby/1.8/puppet/reports/foreman.rb:59:in `process'/usr/lib/ruby/site_ruby/1.8/puppet/indirector/report/processor.rb:37:in `process'/usr/lib/ruby/site_ruby/1.8/puppet/indirector/report/processor.rb:55:in `processors'/usr/lib/ruby/site_ruby/1.8/puppet/indirector/report/processor.rb:53:in `each'/usr/lib/ruby/site_ruby/1.8/puppet/indirector/report/processor.rb:53:in `processors'/usr/lib/ruby/site_ruby/1.8/puppet/indirector/report/processor.rb:30:in `process'/usr/lib/ruby/s...

This is the section of code that causes the exception:

    # special fix for false warning about skips
    # sometimes there are skip values, but there are no error messages, we ignore them.
    if report_status["skipped"] > 0 and ((report_status.values.inject(:+)) - report_status["skipped"] == report.logs.size)
      report_status["skipped"] = 0
    end

If I comment out these three lines, the foreman-report_v2 script works fine, although it is probably not handling skips properly.

We are currently using Puppet v2.7.21 on the puppetmaster server, and version ce323b1 of foreman-report_v2.rb.erb

Actions

Also available in: Atom PDF