summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-07-04 16:43:16 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-07-04 16:43:16 +0000
commite17f4ed1d9e4011b0d7ccca35f3ff16541f05f26 (patch)
tree10025f7d877e3a3ff7a8d8be2d2f49b3a46545b4 /lib/puppet
parent1503b42c46d28e6bbb965c97fecd90b765e4356a (diff)
downloadpuppet-e17f4ed1d9e4011b0d7ccca35f3ff16541f05f26.tar.gz
puppet-e17f4ed1d9e4011b0d7ccca35f3ff16541f05f26.tar.xz
puppet-e17f4ed1d9e4011b0d7ccca35f3ff16541f05f26.zip
adding host information to reports and tagmail report
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1361 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/reports/tagmail.rb4
-rwxr-xr-xlib/puppet/server/report.rb7
-rw-r--r--lib/puppet/transaction/report.rb4
3 files changed, 9 insertions, 6 deletions
diff --git a/lib/puppet/reports/tagmail.rb b/lib/puppet/reports/tagmail.rb
index 4ef8660e6..a15fa8bff 100644
--- a/lib/puppet/reports/tagmail.rb
+++ b/lib/puppet/reports/tagmail.rb
@@ -69,7 +69,9 @@ Puppet::Server::Report.newreport(:tagmail) do |report|
Puppet.info "Sending report to %s" % emails.join(", ")
# We need to open a separate process for every set of email addresses
IO.popen(Puppet[:sendmail] + " " + emails.join(" "), "w") do |p|
- p.puts "From: #{Puppet[:reportfrom]}\nSubject: Puppet Report"
+ p.puts "From: #{Puppet[:reportfrom]}"
+ p.puts "Subject: Puppet Report for %s" % report.host
+
p.puts messages
end
end
diff --git a/lib/puppet/server/report.rb b/lib/puppet/server/report.rb
index 54cb71960..e584fb61b 100755
--- a/lib/puppet/server/report.rb
+++ b/lib/puppet/server/report.rb
@@ -46,9 +46,8 @@ class Server
name = name.intern if name.is_a? String
unless @reports.include? reportmethod(name)
begin
- require "puppet/reports/#{name}"
+ require "puppet/reports/#{name.to_s}"
unless @reports.include? name
- p @reports
Puppet.warning(
"Loaded report file for %s but report was not defined" %
name
@@ -61,7 +60,7 @@ class Server
end
Puppet.warning "Could not load report %s: %s" %
[name, detail]
- next
+ return nil
end
end
@@ -77,7 +76,7 @@ class Server
# Dynamically create the report methods as necessary.
def method_missing(name, *args)
if name.to_s =~ /^report_(.+)$/
- if self.class.report($2)
+ if self.class.report($1)
send(name, *args)
else
super
diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb
index cca1a90f2..2a81251a3 100644
--- a/lib/puppet/transaction/report.rb
+++ b/lib/puppet/transaction/report.rb
@@ -5,7 +5,7 @@ require 'puppet'
# change produces, and Metrics are all of the numerical data involved
# in the transaction.
class Puppet::Transaction::Report
- attr_accessor :logs, :metrics, :time
+ attr_accessor :logs, :metrics, :time, :host
def initialize
@metrics = {}
@@ -14,6 +14,8 @@ class Puppet::Transaction::Report
@records = Hash.new do |hash, key|
hash[key] = []
end
+
+ @host = [Facter.value("hostname"), Facter.value("domain")].join(".")
end
# Create a new metric.