/[adm]/puppet/modules/report-irc_ii/lib/puppet/reports/irc_ii.rb
ViewVC logotype

Contents of /puppet/modules/report-irc_ii/lib/puppet/reports/irc_ii.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2253 - (show annotations) (download)
Sun Jan 15 10:11:54 2012 UTC (12 years, 9 months ago) by misc
File size: 912 byte(s)
add a safeguard against missing path
1 require 'puppet'
2 require 'yaml'
3
4 unless Puppet.version >= '2.6.5'
5 fail "This report processor requires Puppet version 2.6.5 or later"
6 end
7
8 Puppet::Reports.register_report(:irc_ii) do
9 configfile = File.join([File.dirname(Puppet.settings[:config]), "irc_ii.yaml"])
10 raise(Puppet::ParseError, "XMPP report config file #{configfile} not readable") unless File.exist?(configfile)
11
12 config = YAML.load_file(configfile)
13 II_PATH = config[:ii_path]
14
15 desc <<-DESC
16 Send notification of failed reports to an IRC channel, using a existing ii setup.
17 DESC
18
19 def process
20 if self.status == 'failed'
21 message = "Puppet run for #{self.host} #{self.status} at #{Time.now.asctime}."
22 if File.exist?(II_PATH)
23 Puppet::Util::SUIDManager.run_and_capture("echo #{message} > #{II_PATH}" , "nobody", "nogroup")
24 end
25 end
26 end
27 end

Properties

Name Value
svn:keywords "ID Date Rev"

  ViewVC Help
Powered by ViewVC 1.1.30