From 70143d217fcf3cd2bfbcfd0e5c9c38292716de2b Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 30 Jun 2006 20:43:29 +0000 Subject: Trying to merge metrics and reports. There is now a separate transaction report class, and it works throughout the previously existing system. I will next go through trying to make a metric report that graphs the metrics in rrd. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1347 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/client/master.rb | 17 +++++------------ lib/puppet/client/reporter.rb | 14 ++++++-------- 2 files changed, 11 insertions(+), 20 deletions(-) (limited to 'lib/puppet/client') diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb index 6d57a310a..2544d3aef 100644 --- a/lib/puppet/client/master.rb +++ b/lib/puppet/client/master.rb @@ -76,12 +76,7 @@ class Puppet::Client::MasterClient < Puppet::Client raise Puppet::Error, "Cannot apply; objects not defined" end - # this is a gross hack... but i don't see a good way around it - # set all of the variables to empty - Puppet::Transaction.init - transaction = @objects.evaluate - transaction.toplevel = true if tags transaction.tags = tags @@ -104,16 +99,14 @@ class Puppet::Client::MasterClient < Puppet::Client ensure Puppet::Storage.store end - Puppet::Metric.gather - Puppet::Metric.tally - if Puppet[:rrdgraph] == true - Metric.store - Metric.graph - end if Puppet[:report] + report = transaction.report() + if Puppet[:rrdgraph] == true + report.graph() + end begin - reportclient().report(transaction) + reportclient().report(report) rescue => detail Puppet.err "Reporting failed: %s" % detail end diff --git a/lib/puppet/client/reporter.rb b/lib/puppet/client/reporter.rb index ff80f367d..b0101e2fa 100644 --- a/lib/puppet/client/reporter.rb +++ b/lib/puppet/client/reporter.rb @@ -13,24 +13,22 @@ class Puppet::Client::Reporter < Puppet::Client::ProxyClient super(hash) end - # Send our report. We get the transaction, and we convert it to a report + # Send our report. We get the transaction report and convert it to YAML # as appropriate. - def report(transaction) - # We receive an array of log events, and we need to convert them into - # a single big YAML file. - - array = transaction.report - - report = YAML.dump(array) + def report(transreport) + report = YAML.dump(transreport) unless self.local report = CGI.escape(report) end # Now send the report + file = nil benchmark(:info, "Sent transaction report") do file = @driver.report(report) end + + file end end -- cgit