From c5d67a3756da7d4cb611d07250c63201aa2d794a Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sun, 15 Jan 2012 10:11:58 +0000 Subject: also rename the module --- modules/report-irc_ii/lib/puppet/reports/socket.rb | 28 ---------------------- modules/report-socket/lib/puppet/reports/socket.rb | 28 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 28 deletions(-) delete mode 100644 modules/report-irc_ii/lib/puppet/reports/socket.rb create mode 100644 modules/report-socket/lib/puppet/reports/socket.rb diff --git a/modules/report-irc_ii/lib/puppet/reports/socket.rb b/modules/report-irc_ii/lib/puppet/reports/socket.rb deleted file mode 100644 index f682cb98..00000000 --- a/modules/report-irc_ii/lib/puppet/reports/socket.rb +++ /dev/null @@ -1,28 +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(: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 diff --git a/modules/report-socket/lib/puppet/reports/socket.rb b/modules/report-socket/lib/puppet/reports/socket.rb new file mode 100644 index 00000000..f682cb98 --- /dev/null +++ b/modules/report-socket/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 -- cgit v1.2.1