summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-07-04 23:53:23 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-07-04 23:53:23 +0000
commitafe84ecaa26b280bf3cbf1544197cc92389a6446 (patch)
treedef39159bc54efe00bd52a4204fdde9070d365a7 /lib
parente17f4ed1d9e4011b0d7ccca35f3ff16541f05f26 (diff)
downloadpuppet-afe84ecaa26b280bf3cbf1544197cc92389a6446.tar.gz
puppet-afe84ecaa26b280bf3cbf1544197cc92389a6446.tar.xz
puppet-afe84ecaa26b280bf3cbf1544197cc92389a6446.zip
small fixes towards 0.18.2
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1362 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/reports/tagmail.rb66
-rw-r--r--lib/puppet/type/zone.rb1
2 files changed, 36 insertions, 31 deletions
diff --git a/lib/puppet/reports/tagmail.rb b/lib/puppet/reports/tagmail.rb
index a15fa8bff..b6593939c 100644
--- a/lib/puppet/reports/tagmail.rb
+++ b/lib/puppet/reports/tagmail.rb
@@ -45,44 +45,50 @@ Puppet::Server::Report.newreport(:tagmail) do |report|
if messages and ! messages.empty?
reports[emails] = messages.collect { |m| m.to_report }.join("\n")
+ else
+ Puppet.info "No messages to report"
end
end
- if Puppet[:smtpserver] != "none"
- begin
- Net::SMTP.start(Puppet[:smtpserver]) do |smtp|
- reports.each do |emails, messages|
- Puppet.info "Sending report to %s" % emails.join(", ")
- smtp.send_message(messages, Puppet[:reportfrom], *emails)
+ # Let's fork for the sending of the email, since you never know what might
+ # happen.
+ fork do
+ if Puppet[:smtpserver] != "none"
+ begin
+ Net::SMTP.start(Puppet[:smtpserver]) do |smtp|
+ reports.each do |emails, messages|
+ Puppet.info "Sending report to %s" % emails.join(", ")
+ smtp.send_message(messages, Puppet[:reportfrom], *emails)
+ end
end
+ rescue => detail
+ if Puppet[:debug]
+ puts detail.backtrace
+ end
+ raise Puppet::Error,
+ "Could not send report emails through smtp: %s" % detail
end
- rescue => detail
- if Puppet[:debug]
- puts detail.backtrace
- end
- raise Puppet::Error,
- "Could not send report emails through smtp: %s" % detail
- end
- elsif Puppet[:sendmail] != ""
- begin
- reports.each do |emails, messages|
- 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]}"
- p.puts "Subject: Puppet Report for %s" % report.host
+ elsif Puppet[:sendmail] != ""
+ begin
+ reports.each do |emails, messages|
+ 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]}"
+ p.puts "Subject: Puppet Report for %s" % report.host
- p.puts messages
+ p.puts messages
+ end
end
+ rescue => detail
+ if Puppet[:debug]
+ puts detail.backtrace
+ end
+ raise Puppet::Error,
+ "Could not send report emails via sendmail: %s" % detail
end
- rescue => detail
- if Puppet[:debug]
- puts detail.backtrace
- end
- raise Puppet::Error,
- "Could not send report emails via sendmail: %s" % detail
+ else
+ raise Puppet::Error, "SMTP server is unset and could not find sendmail"
end
- else
- raise Puppet::Error, "SMTP server is unset and could not find sendmail"
end
end
diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb
index 640ed8f99..cfa8bed37 100644
--- a/lib/puppet/type/zone.rb
+++ b/lib/puppet/type/zone.rb
@@ -187,7 +187,6 @@ Puppet::Type.newtype(:zone) do
validate do |value|
unless value =~ /:/
- p value
raise ArgumentError,
"IP addresses must specify the interface and the address, separated by a colon."
end