Class: Puppet::Network::Handler::Report

Inherits:
Handler
  • Object
show all
Defined in:
lib/vendor/puppet/network/handler/report.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Report

Returns a new instance of Report.



21
22
23
24
# File 'lib/vendor/puppet/network/handler/report.rb', line 21

def initialize(*args)
  super
  Puppet.settings.use(:main, :reporting, :metrics)
end

Class Method Details

.newreport(name, options = {}, &block) ⇒ Object

Add a new report type.



16
17
18
19
# File 'lib/vendor/puppet/network/handler/report.rb', line 16

def self.newreport(name, options = {}, &block)
  Puppet.warning "The interface for registering report types has changed; use Puppet::Reports.register_report for report type #{name}"
  Puppet::Reports.register_report(name, options, &block)
end

Instance Method Details

#report(report, client = nil, clientip = nil) ⇒ Object

Accept a report from a client.



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/vendor/puppet/network/handler/report.rb', line 27

def report(report, client = nil, clientip = nil)
  # Unescape the report
  report = CGI.unescape(report) unless @local

  Puppet.info "Processing reports #{reports().join(", ")} for #{client}"
  begin
    process(report)
  rescue => detail
    Puppet.err "Could not process report for #{client}: #{detail}"
    puts detail.backtrace if Puppet[:trace]
  end
end