class Report::Processor

Public Class Methods

new() click to toggle source
# File lib/puppet/indirector/report/processor.rb, line 9
def initialize
  Puppet.settings.use(:main, :reporting, :metrics)
end

Public Instance Methods

destroy(request) click to toggle source
# File lib/puppet/indirector/report/processor.rb, line 17
def destroy(request)
  processors do |mod|
    mod.destroy(request.key) if mod.respond_to?(:destroy)
  end
end
save(request) click to toggle source
# File lib/puppet/indirector/report/processor.rb, line 13
def save(request)
  process(request.instance)
end

Private Instance Methods

process(report) click to toggle source

Process the report with each of the configured report types. LAK:NOTE This isn’t necessarily the best design, but it’s backward compatible and that’s good enough for now.

# File lib/puppet/indirector/report/processor.rb, line 28
def process(report)
  Puppet.debug "Received report to process from #{report.host}"
  processors do |mod|
    Puppet.debug "Processing report from #{report.host} with processor #{mod}"
    # We have to use a dup because we're including a module in the
    # report.
    newrep = report.dup
    begin
      newrep.extend(mod)
      newrep.process
    rescue => detail
      Puppet.log_exception(detail, "Report #{name} failed: #{detail}")
    end
  end
end
processors() { |mod| ... } click to toggle source
# File lib/puppet/indirector/report/processor.rb, line 50
def processors(&blk)
  return if Puppet[:reports] == "none"
  reports.each do |name|
    if mod = Puppet::Reports.report(name)
      yield(mod)
    else
      Puppet.warning "No report named '#{name}'"
    end
  end
end
reports() click to toggle source

Handle the parsing of the reports attribute.

# File lib/puppet/indirector/report/processor.rb, line 45
def reports
  # LAK:NOTE See http://snurl.com/21zf8  [groups_google_com]
  x = Puppet[:reports].gsub(/(^\s+)|(\s+$)/, '').split(/\s*,\s*/)
end