summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/client/report.rb
blob: c9afaf969a1741c86f42459a11cca3f696b31331 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Puppet::Network::Client::Report < Puppet::Network::Client
  @handler = Puppet::Network::Handler.handler(:report)

  def initialize(hash = {})
    hash[:Report] = self.class.handler.new if hash.include?(:Report)

    super(hash)
  end

  # Send our report.  We get the transaction report and convert it to YAML
  # as appropriate.
  def report(transreport)
    report = YAML.dump(transreport)

    report = CGI.escape(report) unless self.local

    # Now send the report
    file = nil
    benchmark(:info, "Sent transaction report") do
      file = @driver.report(report)
    end

    file
  end
end