diff options
author | Michael Scherer <misc@mageia.org> | 2012-01-15 10:11:56 +0000 |
---|---|---|
committer | Michael Scherer <misc@mageia.org> | 2012-01-15 10:11:56 +0000 |
commit | 0301384465a57f68061340287061ba9b26b90097 (patch) | |
tree | 5d0be05114ae95b1a4b60fc29131213fd2947fd0 | |
parent | ea3b80cb740a1b5df663dbe4ee06b370df156423 (diff) | |
download | puppet-0301384465a57f68061340287061ba9b26b90097.tar puppet-0301384465a57f68061340287061ba9b26b90097.tar.gz puppet-0301384465a57f68061340287061ba9b26b90097.tar.bz2 puppet-0301384465a57f68061340287061ba9b26b90097.tar.xz puppet-0301384465a57f68061340287061ba9b26b90097.zip |
rename the file and the module to socket
-rw-r--r-- | modules/report-irc_ii/lib/puppet/reports/irc_ii.rb | 27 | ||||
-rw-r--r-- | modules/report-irc_ii/lib/puppet/reports/socket.rb | 28 |
2 files changed, 28 insertions, 27 deletions
diff --git a/modules/report-irc_ii/lib/puppet/reports/irc_ii.rb b/modules/report-irc_ii/lib/puppet/reports/irc_ii.rb deleted file mode 100644 index 3262f3ce..00000000 --- a/modules/report-irc_ii/lib/puppet/reports/irc_ii.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'puppet' -require 'yaml' - -unless Puppet.version >= '2.6.5' - fail "This report processor requires Puppet version 2.6.5 or later" -end - -Puppet::Reports.register_report(:irc_ii) do - configfile = File.join([File.dirname(Puppet.settings[:config]), "irc_ii.yaml"]) - raise(Puppet::ParseError, "XMPP report config file #{configfile} not readable") unless File.exist?(configfile) - - config = YAML.load_file(configfile) - II_PATH = config[:ii_path] - - desc <<-DESC - Send notification of failed reports to an IRC channel, using a existing ii setup. - DESC - - def process - if self.status == 'failed' - message = "Puppet run for #{self.host} #{self.status} at #{Time.now.asctime}." - if File.exist?(II_PATH) - Puppet::Util::SUIDManager.run_and_capture("echo #{message} > #{II_PATH}" , "nobody", "nogroup") - end - end - end -end diff --git a/modules/report-irc_ii/lib/puppet/reports/socket.rb b/modules/report-irc_ii/lib/puppet/reports/socket.rb new file mode 100644 index 00000000..f682cb98 --- /dev/null +++ b/modules/report-irc_ii/lib/puppet/reports/socket.rb @@ -0,0 +1,28 @@ +require 'puppet' +require 'yaml' + +unless Puppet.version >= '2.6.5' + fail "This report processor requires Puppet version 2.6.5 or later" +end + +Puppet::Reports.register_report(:socket) do + configfile = File.join([File.dirname(Puppet.settings[:config]), "socket.yaml"]) + raise(Puppet::ParseError, "Socket report config file #{configfile} not readable") unless File.exist?(configfile) + + config = YAML.load_file(configfile) + SOCKET_PATH = config[:socket_path] + # TODO add support for using another user ? + + desc <<-DESC + Send notification of failed reports to a socket. + DESC + + def process + if self.status == 'failed' + message = "Puppet run for #{self.host} #{self.status} at #{Time.now.asctime}." + if File.exist?(SOCKET_PATH) + Puppet::Util.execute("echo #{message} > #{SOCKET_PATH}" , "nobody", "nogroup") + end + end + end +end |