Sha256: 5e60c0aa8d2db2302669b9d0c584406fe6b67e11deddcfa136cb4209cd8427b7

Contents?: true

Size: 1012 Bytes

Versions: 1

Compression:

Stored size: 1012 Bytes

Contents

require 'puppet'

# A class for reporting what happens on each client.  Reports consist of
# two types of data:  Logs and Metrics.  Logs are the output that each
# change produces, and Metrics are all of the numerical data involved
# in the transaction.
class Puppet::Transaction::Report
    attr_accessor :logs, :metrics, :time, :host

    def initialize
        @metrics = {}
        @logs = []

        @records = Hash.new do |hash, key|
            hash[key] = []
        end

        @host = [Facter.value("hostname"), Facter.value("domain")].join(".")
    end

    # Create a new metric.
    def newmetric(name, hash)
        metric = Puppet::Metric.new(name)

        hash.each do |name, value|
            metric.newvalue(name, value)
        end

        @metrics[metric.name] = metric
    end

    # Add a new log message.
    def newlog(msg)
        @logs << msg
    end

    def record(metric, object)
        @records[metric] << object
    end
end

# $Id: report.rb 1361 2006-07-04 16:43:16Z luke $

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-0.18.4 lib/puppet/transaction/report.rb