summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-30 20:43:55 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-30 20:43:55 +0000
commitdea7e24423adbb8bc0839dedcf1157d6dff6a91b (patch)
tree59dead8edb5b11cbfdeb33449977a0b8636e6cc9 /lib
parent70143d217fcf3cd2bfbcfd0e5c9c38292716de2b (diff)
downloadpuppet-dea7e24423adbb8bc0839dedcf1157d6dff6a91b.tar.gz
puppet-dea7e24423adbb8bc0839dedcf1157d6dff6a91b.tar.xz
puppet-dea7e24423adbb8bc0839dedcf1157d6dff6a91b.zip
oops; adding transaction report class
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1348 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/transaction/report.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb
new file mode 100644
index 000000000..93afa284a
--- /dev/null
+++ b/lib/puppet/transaction/report.rb
@@ -0,0 +1,40 @@
+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
+
+ def initialize
+ @metrics = {}
+ @logs = []
+
+ @records = Hash.new do |hash, key|
+ hash[key] = []
+ end
+ 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$