summaryrefslogtreecommitdiffstats
path: root/lib/puppet/reports
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-10-13 14:07:24 -0500
committerLuke Kanies <luke@madstop.com>2007-10-13 14:07:24 -0500
commit29feac0cecddc910b74601d0914fa2c83757b10c (patch)
tree888305ecde1e4a488304f7e2e169bf1ca38e6d19 /lib/puppet/reports
parent74d77f76a012d523430e43f1092609a4ca584cc7 (diff)
downloadpuppet-29feac0cecddc910b74601d0914fa2c83757b10c.tar.gz
puppet-29feac0cecddc910b74601d0914fa2c83757b10c.tar.xz
puppet-29feac0cecddc910b74601d0914fa2c83757b10c.zip
Translating the report handler to an indirected model.
I've provided backward compatibility with the old handler. The only terminus type that currently exists for reports is the 'code' terminus, which is used to process reports in the style of the old handler. At some point, we should likely switch at least some of these report types (e.g., 'store') to terminus types.
Diffstat (limited to 'lib/puppet/reports')
-rw-r--r--lib/puppet/reports/log.rb4
-rw-r--r--lib/puppet/reports/rrdgraph.rb4
-rw-r--r--lib/puppet/reports/store.rb6
-rw-r--r--lib/puppet/reports/tagmail.rb2
4 files changed, 7 insertions, 9 deletions
diff --git a/lib/puppet/reports/log.rb b/lib/puppet/reports/log.rb
index 8f7b95f8b..8dfeedb07 100644
--- a/lib/puppet/reports/log.rb
+++ b/lib/puppet/reports/log.rb
@@ -1,6 +1,6 @@
-require 'puppet'
+require 'puppet/reports'
-Puppet::Network::Handler.report.newreport(:log) do
+Puppet::Reports.register_report(:log) do
desc "Send all received logs to the local log destinations. Usually
the log destination is syslog."
diff --git a/lib/puppet/reports/rrdgraph.rb b/lib/puppet/reports/rrdgraph.rb
index 9ab1f4b17..2611f0369 100644
--- a/lib/puppet/reports/rrdgraph.rb
+++ b/lib/puppet/reports/rrdgraph.rb
@@ -1,6 +1,4 @@
-require 'puppet'
-
-Puppet::Network::Handler.report.newreport(:rrdgraph) do
+Puppet::Reports.register_report(:rrdgraph) do
desc "Graph all available data about hosts using the RRD library. You
must have the Ruby RRDtool library installed to use this report, which
you can get from `the RubyRRDTool RubyForge page`_. This package requires
diff --git a/lib/puppet/reports/store.rb b/lib/puppet/reports/store.rb
index 0c3e86f37..dfc992820 100644
--- a/lib/puppet/reports/store.rb
+++ b/lib/puppet/reports/store.rb
@@ -1,6 +1,6 @@
require 'puppet'
-Puppet::Network::Handler.report.newreport(:store, :useyaml => true) do
+Puppet::Reports.register_report(:store) do
Puppet.settings.use(:reporting)
desc "Store the yaml report on disk. Each host sends its report as a YAML dump
@@ -24,7 +24,7 @@ Puppet::Network::Handler.report.newreport(:store, :useyaml => true) do
config.use("reportclient-#{client}")
end
- def process(yaml)
+ def process
# We don't want any tracking back in the fs. Unlikely, but there
# you go.
client = self.host.gsub("..",".")
@@ -46,7 +46,7 @@ Puppet::Network::Handler.report.newreport(:store, :useyaml => true) do
begin
File.open(file, "w", 0640) do |f|
- f.print yaml
+ f.print to_yaml
end
rescue => detail
if Puppet[:trace]
diff --git a/lib/puppet/reports/tagmail.rb b/lib/puppet/reports/tagmail.rb
index fd9126a1a..a2c973f8f 100644
--- a/lib/puppet/reports/tagmail.rb
+++ b/lib/puppet/reports/tagmail.rb
@@ -3,7 +3,7 @@ require 'pp'
require 'net/smtp'
-Puppet::Network::Handler.report.newreport(:tagmail) do
+Puppet::Reports.register_report(:tagmail) do
desc "This report sends specific log messages to specific email addresses
based on the tags in the log messages. See the
`UsingTags tag documentation`:trac: for more information